#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long int
#define endl '\n'
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
#define all(v) v.begin(), v.end()
#define pb push_back //
#define mp make_pair
#define fi first //
#define se second //
#define yes cout << "YES" << endl //
#define no cout << "NO" << endl //
#define M 1000000007 // 1e9+7
#define gcd(a, b) __gcd(a, b) //
#define lcm(a, b) a *b / gcd(a, b) //
#define memz(a) memset(a, 0, sizeof(a)) //
#define memn(a) memset(a, -1, sizeof(a)) //
ll dfs(ll par,ll node,ll light[],ll val[],vector<ll>graph[],ll parent[])
{
val[node]=0;
parent[node]=par;
for(auto child:graph[node])
{
if(child!=par)val[node]+=dfs(node,child,light,val,graph,parent);
}
val[node]+=light[node];
return val[node];
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll n;
cin>>n;
ll light[n+1];
for(int i=1;i<=n;i++)cin>>light[i];
ll val[n+1];
vector<ll>graph[n+1];
for(int i=1;i<n;i++)
{
ll a,b;
cin>>a>>b;
graph[a].push_back(b);
graph[b].push_back(a);
}
ll parent[n+1];
dfs(0,1,light,val,graph,parent);
ll q;
cin>>q;
while(q--)
{
ll c,p;
cin>>c>>p;
if(c==2)cout<<val[p]<<endl;
else
{
ll cng;
if(light[p]==0)cng=1;
else cng=-1;
while(p!=0)
{
val[p]+=cng;
p=parent[p];
}
}
}
}