using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zlatnici3
{
    class Program
    {
        static int indeksMaximuma(int[] a)
        {
            Array.Sort(a);
            return a.Length - 1;
        }
        static int min(int[] a)
        {
            Array.Sort(a);
            return a[0];
        }
        static int max(int[] a)
        {
            Array.Sort(a);
            return a[a.Length - 1];
        }
        static void upiti(int n, int[] x, int[] y, int[] a, int q, int[] b, int[] c)
        {
            for (int i = 0; i <= q; i++)
            {
                for (int j = n - 2; j >= 0; j--)
                {
                    if (a[y[j]] != max(a))
                    {
                        a[x[j]] += a[y[j]];
                        a[y[j]] = 0;
                    }
                }
                if (max(a) != min(a))
                    Console.WriteLine(indeksMaximuma(a) + 1);
                else
                    Console.WriteLine(n / 2 + 1);
                if (i != q)
                    a[c[i]] += b[i];
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = new int[n - 1];
            int[] y = new int[n - 1];
            for (int i = 0; i < n - 1; i++)
            {
                string[] str = Console.ReadLine().Split();
                x[i] = int.Parse(str[0]) - 1;
                y[i] = int.Parse(str[1]) - 1;
            }
            int[] a = new int[n];
            string[] s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
                a[i] = int.Parse(s[i]);
            int q = int.Parse(Console.ReadLine());
            int[] b = new int[q];
            int[] c = new int[q];
            for (int i = 0; i < q; i++)
            {
                string[] str = Console.ReadLine().Split();
                b[i] = int.Parse(str[0]);
                c[i] = int.Parse(str[1]) - 1;
            }

            upiti(n, x, y, a, q, b, c);
        }
    }
}