$Jaggu$ monkey a friend of $Choota$ $Bheem$ a great warrior of $Dholakpur$. He gets everything he wants. Being a friend of $Choota$ $Bheem$ he never has to struggle for anything, because of this he is in a great debt of $Choota$ $Bheem$, he really wants to pay his debt off.
Finally the time has come to pay his debt off, $Jaggu$ is on a magical tree. He wants to collect apples from different branches but he is in a hurry. $Botakpur$ has attacked on $Dholakpur$ and $Bheem$ is severely injured, as been instructed by the village witch, $Bheem$ can only be saved by the apples of the magical tree. Each apple is placed in Tree Node structure and each apple has some sweetness. Now there's a problem as $Jaggu$ is also injured so he can only slide downwards and alse is collecting apples in his hand so he can't climb. You would be given $Q$ queries. Queries are of 2 type :-
- 
Ending Node Node of $Jaggu$ is given. $format$ - type of query node -(1 2)
- 
Sweetness of Apple on a given node is changed. $format$ - type of query node new sweetness(2 3 10)
$Note$: $Jaggu$ is always on the top of tree initially in each query.The sweetness is always positive.
Help $Jaggu$ in saving $Bheem$

-----Input:-----
- First line contains $N$ - (number of nodes).  
- Next line contains $N$ integers with space giving sweetness of apple on Nodes $(1 to N)$
- Next $N-1$ lines contain  $N1$ $N2$ connected nodes.
- Next line contains single integer $Q$ Number of queries

-----Output:-----
- For each query of type 1, print total sweetness of apples. 

-----Constraints-----
- $1 \leq N \leq 10^4$
- $2 \leq Q \leq 10^4$

-----Sample Input:-----
10
10 12 6 8 1 19 0 5 13 17
1 2
1 3
1 4
3 10
4 8
8 9
4 5
5 7
5 6
3
1 1
2 3 20
1 8

-----Sample Output:-----
10
23

-----EXPLANATION:-----
This sweetness array is :
$[10,2,6,8,1,19,0,5,13,17]$
The tree is:
1   

/  |   \      

2    3     4     

/    /    \      

10     8        5   

/        /    \     

9         7        6

Starter code:

Solutions:
counter = -1
def flattree(node):
    nonlocal counter
    if visited[node]==1:
        return
    else:
        visited[node]=1
        counter += 1
        i_c[node] = counter

        flat_tree[counter] = swt[node]

        for i in graph[node]:
            if visited[i]==0:
                flattree(i)
        counter += 1
        o_c[node] = counter
        flat_tree[counter] = -swt[node]
    return


def getsum(BITTree, i):
    s = 0  # initialize result
    i = i + 1
    while i > 0:
        s += BITTree[i]
        i -= i & (-i)
    return s

def upd(BITTree, n, i, v):
    i += 1
    while i <= n:
        BITTree[i] += v
        i += i & (-i)

def construct(arr, n):
    BITTree = [0] * (n + 1)
    for i in range(n):
        upd(BITTree, n, i, arr[i])
    return BITTree

from collections import defaultdict
n = int(input())
swt = list(map(int, input().split()))
graph = defaultdict(list)

for i in range(n-1):
    n1, n2 = list(map(int, input().split()))
    graph[n1-1].append(n2-1)
    graph[n2-1].append(n1-1)

flat_tree = [0]*(2*n+1)
i_c = [0]*n
o_c = [0]*n
visited = [0]*n
flattree(0)

tre = construct(flat_tree, 2*n)

q = int(input())
for i in range(q):
    query = list(map(int, input().split()))
    if query[0] == 1:
        node = query[1] - 1
        answer = getsum(tre, i_c[node])
        print(answer)
    else:
        node = query[1]-1
        upd(flat_tree, (2*n), i_c[node], query[2])
        upd(flat_tree, (2*n), o_c[node], -query[2])


counter = -1
def flattree(node):
    nonlocal counter
    if visited[node]==1:
        return
    else:
        visited[node]=1
        counter += 1
        in_counter[node] = counter

        flat_tree[counter] = sweetness[node]

        for i in graph[node]:
            if visited[i]==0:
                flattree(i)
        counter += 1
        out_counter[node] = counter
        flat_tree[counter] = -sweetness[node]
    return


def getsum(BITTree, i):
    s = 0  # initialize result
    i = i + 1
    while i > 0:
        s += BITTree[i]
        i -= i & (-i)
    return s

def updatebit(BITTree, n, i, v):
    i += 1
    while i <= n:
        BITTree[i] += v
        i += i & (-i)

def construct(arr, n):
    BITTree = [0] * (n + 1)
    for i in range(n):
        updatebit(BITTree, n, i, arr[i])
    return BITTree

from collections import defaultdict
n = int(input())
sweetness = list(map(int, input().split()))
graph = defaultdict(list)

for i in range(n-1):
    n1, n2 = list(map(int, input().split()))
    graph[n1-1].append(n2-1)
    graph[n2-1].append(n1-1)

flat_tree = [0]*(2*n+1)
in_counter = [0]*n
out_counter = [0]*n
visited = [0]*n
flattree(0)
# print(flat_tree)
# print(in_counter)
# print(out_counter)
fenwicktree = construct(flat_tree, 2*n)

q = int(input())
for i in range(q):
    query = list(map(int, input().split()))
    if query[0] == 1:
        node = query[1] - 1
        answer = getsum(fenwicktree, in_counter[node])
        print(answer)
    else:
        node = query[1]-1
        updatebit(flat_tree, (2*n), in_counter[node], query[2])
        updatebit(flat_tree, (2*n), out_counter[node], -query[2])