#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int N = 2e5 + 9;
int start[N], en[N];
vector<ll>flat(N + 5, 0);
vector<ll>g[N], lights(N + 5);
struct ST {
#define lc (n << 1)
#define rc ((n << 1) | 1)
ll t[4 * N], lazy[4 * N];
ST() {
for (int i = 0; i < 4 * N; i++)
t[i] = lazy[i] = 0;
}
inline void push(int n, int st, int en) {
if (lazy[n] == 0) return;
if(lazy[n] % 2 != 0){
t[n] = (en - st + 1) - t[n];
}
if (st != en) {
lazy[lc] += lazy[n];
lazy[rc] += lazy[n];
}
lazy[n] = 0;
}
inline void pull(int n) {
t[n] = t[lc] + t[rc];
}
void build(int n, int st, int en, vector<ll> &arr) {
lazy[n] = 0; // set lazy default value = 0
if (st == en) {
t[n] = arr[st];
return;
}
int mid = (st + en) >> 1;
build(lc, st, mid, arr);
build(rc, mid + 1, en, arr);
pull(n);
}
void update(int n, int st, int en, int l, int r, ll v) {
push(n, st, en); // push the value to left and right child
if (r < st || en < l) return;
if (l <= st && en <= r) {
lazy[n] += v; // set lazy
push(n, st, en);
return;
}
int mid = (st + en) >> 1;
update(lc, st, mid, l, r, v);
update(rc, mid + 1, en, l, r, v);
pull(n);
}
inline ll combine(ll a, ll b) {
return a + b;
}
ll query(int n, int st, int en, int l, int r) {
push(n, st, en);
if (l > en || st > r) return 0; // return null
if (l <= st && en <= r) return t[n];
int mid = (st + en) >> 1;
return combine(query(lc, st, mid, l, r), query(rc, mid + 1, en, l, r));
}
} st;
int tt = 0;
void dfs(int node, int par){
// cerr << endl;
// cerr << node << " " << par << " " << tt << endl;
// cerr << tt << endl;
start[node] = ++tt;
flat[tt] = lights[node];
for(auto it : g[node]){
if(it != par){
dfs(it, node);
}
}
// cerr << tt << endl;
en[node] = tt;
}
int32_t main() {
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].push_back(v);
g[v].push_back(u);
}
dfs(1, 1);
st.build(1, 1, n, flat); // Building the Segment tree
int q;
cin >> q;
while(q--){
int type;
cin >> type;
if(type == 1){
int node;
cin >> node;
st.update(1, 1, n, start[node], en[node], 1);
}
else{
int node;
cin >> node;
// cerr << start[node] << ' ' << en[node] << endl;
cout << st.query(1, 1, n, start[node], en[node]) << endl;
}
}
return 0;
}