/*** author: yuji9511 ***/ #include using namespace std; using ll = long long; using lpair = pair; const ll MOD = 1e9+7; const ll INF = 1e18; #define rep(i,m,n) for(ll i=(m);i<(n);i++) #define rrep(i,m,n) for(ll i=(m);i>=(n);i--) #define printa(x,n) for(ll i=0;i void print(H&& h, T&&... t){cout<(t)...);} int parent[100010] = {}; int depth[100010] = {}; int next_val[25][100010] = {}; ll logN = 0; ll N; vector tree[100010]; void dfs(ll cur, ll par, ll d){ depth[cur] = d; parent[cur] = par; for(auto &e: tree[cur]){ if(e == par) continue; dfs(e, cur, d+1); } } ll getParent(ll cur, ll num) { ll p = cur; rrep(k,logN-1, 0){ if(p == -1){ break; } if((num >> k) & 1){ p = next_val[k][p]; } } return p; } ll getLCA(ll va, ll vb){ if(depth[va] > depth[vb]){ va = getParent(va, depth[va] - depth[vb]); }else if(depth[va] < depth[vb]){ vb = getParent(vb, depth[vb] - depth[va]); } ll lv = -1, rv = N+1; while(rv - lv > 1){ ll mid = (rv + lv) / 2; ll ta = getParent(va, mid); ll tb = getParent(vb, mid); if(ta == -1 || tb == -1){ rv = mid; }else if(ta != tb){ lv = mid; }else{ rv = mid; } } return getParent(va, rv); } struct SegmentTree { private: int n; vector node; public: SegmentTree(ll N, ll A[]){ ll sz = N; n = 1; while(n < sz) n *= 2; node.resize(2*n-1, INF); // rep(i,0,sz) node[i+n-1] = INF; rep(i,0,sz) node[i+n-1] = A[i]; // rrep(i,n-2,0) node[i] = min(node[2*i+1], node[2*i+2]); rrep(i,n-2,0) node[i] = getLCA(node[2*i+1], node[2*i+2]); } void update(ll x, ll val){ x += n-1; node[x] = val; while(x > 0){ x = (x-1)/2; node[x] = getLCA(node[2*x+1], node[2*x+2]); } } // void add(ll x, ll val){ // x += n-1; // node[x] += val; // while(x > 0){ // x = (x-1)/2; // node[x] = min(node[2*x+1], node[2*x+2]); // } // } ll get_LCA(ll a, ll b){ ll res = INF; a += n; b += n; while(a < b){ if(b & 1){ b -= 1; if(res == INF){ res = node[b-1]; }else{ res = getLCA(res, node[b-1]); } } if(a & 1){ if(res == INF){ res = node[a-1]; }else{ res = getLCA(res, node[a-1]); } a++; } a >>= 1; b >>= 1; } return res; } // ll getsum(ll a, ll b, ll k=0, ll l=0, ll r=-1) { // if(r < 0) r = n; // if(b <= l || r <= a) return 0; // if(a <= l && r <= b) return node[k]; // ll vl = getsum(a, b, 2*k+1, l, (l+r)/2); // ll vr = getsum(a, b, 2*k+2, (l+r)/2, r); // return vl + vr; // } }; ll C[100010], A[100010]; ll max_val[100010] = {}; void dfs2(ll cur, ll par){ if(cur == 0){ max_val[cur] = C[cur]; }else{ max_val[cur] = max(max_val[par], C[cur]); } for(auto &e: tree[cur]){ if(e == par) continue; dfs2(e, cur); } } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll N,K,Q; cin >> N >> K >> Q; rep(i,0,N) cin >> C[i]; rep(i,0,K){ cin >> A[i]; A[i]--; } rep(i,0,N-1){ ll e,f; cin >> e >> f; e--; f--; tree[e].push_back(f); tree[f].push_back(e); } logN = floor(log2(N)) + 1; dfs(0, -1, 0); rep(i,0,N){ next_val[0][i] = parent[i]; } rep(k,0,logN){ rep(i,0,N){ if(next_val[k][i] == -1){ next_val[k+1][i] = -1; }else{ next_val[k+1][i] = next_val[k][next_val[k][i]]; } } } dfs2(0, -1); SegmentTree sg(K, A); while(Q--){ ll t; cin >> t; if(t == 1){ ll x,y; cin >> x >> y; x--; y--; sg.update(x, y); }else{ ll l,r; cin >> l >> r; l--; r--; ll v = sg.get_LCA(l, r+1); print(max_val[v]); } } }