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

namespace zadatak5
{
    internal class Program
    {
        struct Portal
        {
            public int banka1;
            public int banka2;
        }
        struct Upit
        {
            public int zlatnici;
            public int banka;
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Portal[] portali = new Portal[n];
            for (int i = 0; i < n - 1; i++)
            {
                int[] banke = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                portali[i].banka1 = banke[0];
                portali[i].banka2 = banke[1];
            }
            int[] zlatnici = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int q = int.Parse(Console.ReadLine());
            Upit[] upiti = new Upit[q];
            for (int i = 0; i < q; i++)
            {
                int[] jedanUpit = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                upiti[i].zlatnici = jedanUpit[0];
                upiti[i].banka = jedanUpit[1];
            }
            int[] najmanjiBrojKristala = new int[q + 1];
            for (int i = -1; i < q; i++)
            {
                if (i != -1) zlatnici[upiti[i].banka - 1] += upiti[i].zlatnici;
                int[] brojKristala = new int[n];
                for (int a = 1; a <= n; a++)
                {
                    int[] brPortala = new int[n];
                    brPortala[a - 1] = -1;
                    for (int j = 0; j < portali.Length; j++)
                    {
                        if (portali[j].banka1 == a) brPortala[portali[j].banka2 - 1] = 1;
                        else if (portali[j].banka2 == a) brPortala[portali[j].banka1 - 1] = 1;
                    }
                    for (int j = 1; j < portali.Length; j++)
                    {
                        for (int k = 1; k <= brPortala.Length; k++)
                        {
                            if (brPortala[k - 1] == j)
                            {
                                for (int l = 0; l < portali.Length; l++)
                                {
                                    if (portali[l].banka1 == k && !Convert.ToBoolean(brPortala[portali[l].banka2 - 1])) brPortala[portali[l].banka2 - 1] = j + 1;
                                    else if (portali[l].banka2 == k && !Convert.ToBoolean(brPortala[portali[l].banka1 - 1])) brPortala[portali[l].banka1 - 1] = j + 1;
                                }
                            }
                        }
                        bool kraj = true;
                        for (int k = 0; k < brPortala.Length; k++)
                        {
                            if (!Convert.ToBoolean(brPortala[k])) kraj = false;
                        }
                        if (kraj) break;
                    }
                    for (int j = 0; j < n; j++)
                    {
                        if (brPortala[j] > 0) brojKristala[a - 1] += brPortala[j] * zlatnici[j];
                    }
                }
                int min = brojKristala[0];
                int indexMin = 0;
                for (int j = 1; j < brojKristala.Length; j++)
                {
                    if (brojKristala[j] < min)
                    {
                        min = brojKristala[j];
                        indexMin = j;
                    }
                }
                najmanjiBrojKristala[i + 1] = indexMin + 1;
            }
            for (int i = 0; i < najmanjiBrojKristala.Length; i++)
            {
                Console.WriteLine(najmanjiBrojKristala[i]);
            }
        }
    }
}