// PIPRA || HABIB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
#define pb push_back
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define ii pair<int,int>
#define endl "\n"
const int N = 2e5 + 5;
vector<vector<int>> g(N);
vector<int> euler, in_time(N), out_time(N), lights(N);
vector<int> seg(4 * N);
vector<int> lazy(4 * N);
void dfs(int u, int par = -1){
in_time[u] = euler.size();
euler.pb(u);
for(auto v: g[u]){
if(v == par) continue;
dfs(v, u);
}
out_time[u] = euler.size() - 1;
}
void build(int ind, int start, int end){
if(start == end){
seg[ind] = lights[euler[start]];
return;
}
int mid = (start + end) / 2;
int li = (2 * ind);
int ri = (2 * ind) + 1;
build(li, start, mid);
build(ri, mid+1, end);
seg[ind] = seg[li] + seg[ri];
}
void propagate(int ind, int start, int end){
if(lazy[ind] != 0){
seg[ind] = (end - start + 1) - seg[ind];
if(start != end){
lazy[2*ind] ^= lazy[ind];
lazy[2*ind+1] ^= lazy[ind];
}
lazy[ind] = 0;
}
}
void update_range(int ind, int start, int end, int l, int r){
propagate(ind, start, end);
if(start > r or end < l) return;
if(start >= l and end <= r){
lazy[ind] ^= 1;
propagate(ind, start, end);
return;
}
int mid = (start + end) / 2;
int li = (2 * ind);
int ri = (2 * ind) + 1;
update_range(li, start, mid, l, r);
update_range(ri, mid+1, end, l, r);
seg[ind] = seg[li] + seg[ri];
}
int query_range(int ind, int start, int end, int l, int r){
propagate(ind, start, end);
if(start > r or end < l) return 0;
if(start >= l and end <= r) return seg[ind];
int mid = (start + end) / 1;
int li = (2 * ind);
int ri = (2 * ind) + 1;
return query_range(li, start, mid, l, r) +
query_range(ri, mid+1, end, l, r);
}
void pipra(){
int n; cin >> n;
for(int i=1 ; i<=n ; i++)
cin >> lights[i];
for(int i=1 ; i<n ; i++){
int u, v; cin >> u >> v;
g[u].pb(v);
g[v].pb(u);
}
dfs(1);
build(1, 0, n-1);
int q; cin >> q;
while(q--){
int type, node;
cin >> type >> node;
if(type == 1){
update_range(1, 0, n-1, in_time[node], out_time[node]);
}
else{
cout << query_range(1, 0, n-1, in_time[node], out_time[node]) << endl;
}
}
}
int32_t main(){
// HABIB
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
// int t; cin>>t;
// while(t--) {
pipra();
// }
return 0 ;
}