$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

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'counter = -1\r\ndef flattree(node):\r\n    nonlocal counter\r\n    if visited[node]==1:\r\n        return\r\n    else:\r\n        visited[node]=1\r\n        counter += 1\r\n        i_c[node] = counter\r\n\r\n        flat_tree[counter] = swt[node]\r\n\r\n        for i in graph[node]:\r\n            if visited[i]==0:\r\n                flattree(i)\r\n        counter += 1\r\n        o_c[node] = counter\r\n        flat_tree[counter] = -swt[node]\r\n    return\r\n\r\n\r\ndef getsum(BITTree, i):\r\n    s = 0  # initialize result\r\n    i = i + 1\r\n    while i > 0:\r\n        s += BITTree[i]\r\n        i -= i & (-i)\r\n    return s\r\n\r\ndef upd(BITTree, n, i, v):\r\n    i += 1\r\n    while i <= n:\r\n        BITTree[i] += v\r\n        i += i & (-i)\r\n\r\ndef construct(arr, n):\r\n    BITTree = [0] * (n + 1)\r\n    for i in range(n):\r\n        upd(BITTree, n, i, arr[i])\r\n    return BITTree\r\n\r\nfrom collections import defaultdict\r\nn = int(input())\r\nswt = list(map(int, input().split()))\r\ngraph = defaultdict(list)\r\n\r\nfor i in range(n-1):\r\n    n1, n2 = list(map(int, input().split()))\r\n    graph[n1-1].append(n2-1)\r\n    graph[n2-1].append(n1-1)\r\n\r\nflat_tree = [0]*(2*n+1)\r\ni_c = [0]*n\r\no_c = [0]*n\r\nvisited = [0]*n\r\nflattree(0)\r\n\r\ntre = construct(flat_tree, 2*n)\r\n\r\nq = int(input())\r\nfor i in range(q):\r\n    query = list(map(int, input().split()))\r\n    if query[0] == 1:\r\n        node = query[1] - 1\r\n        answer = getsum(tre, i_c[node])\r\n        print(answer)\r\n    else:\r\n        node = query[1]-1\r\n        upd(flat_tree, (2*n), i_c[node], query[2])\r\n        upd(flat_tree, (2*n), o_c[node], -query[2])\r\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: