#include "bits/stdc++.h" using namespace std; #define rep(i,n) for(int i=0;iG[200006]; int d[200006]; int par2[20][200006]; int a[100006],c[100006]; void dfs(int now, int par) { par2[0][now] = par; for (int e : G[now]) { if (e == par)continue; d[e] = d[now] + 1; c[e] = max(c[now], c[e]); dfs(e, now); } } int lca(int u, int v) { if (d[u] > d[v])swap(u, v); rep(k, 20) { if ((d[v] - d[u]) >> k & 1) { v = par2[k][v]; } } if (u == v)return u; for (int k = 19; k >= 0; k--) { if (par2[k][u] != par2[k][v]) { u = par2[k][u]; v = par2[k][v]; } } return par2[0][u]; } struct segtree { vectornode; int n; void init(int N) { n = 1; while (n < N)n *= 2; node.resize(2 * n, -1); } void upd(int i, int x) { i += n - 1; node[i] = x; while (i) { i = (i - 1) / 2; int x1 = node[2 * i + 1], x2 = node[2 * i + 2]; if (x1 == -1 && x2 == -1)node[i] = -1; else if (x1 == -1)node[i] = x2; else if (x2 == -1)node[i] = x1; else node[i] = lca(x1, x2); } } int calc(int a, int b, int k, int l, int r) { if (r <= a || b <= l)return -1; if (a <= l&&r <= b)return node[k]; int vl = calc(a, b, k * 2 + 1, l, (l + r) / 2); int vr = calc(a, b, k * 2 + 2, (l + r) / 2, r); if (vl == -1 && vr == -1)return -1; else if (vl == -1)return vr; else if(vr == -1)return vl; else return lca(vl, vr); } int get(int a, int b) { return calc(a, b, 0, 0, n); } }; segtree seg; signed main() { int n, k, q; cin >> n >> k >> q; assert(1 <= n&&n <= 100000 && 1 <= k&&k <= 100000 && 1 <= q&&q <= 100000); rep(i, n) { cin >> c[i]; assert(1 <= c[i] && c[i] <= 1000000000); } rep(i, k) { cin >> a[i]; assert(1 <= a[i] && a[i] <= n); } rep(i, n - 1) { int a, b; cin >> a >> b; assert(1 <= a&&a <= n && 1 <= b&&b <= n); a--; b--; G[a].push_back(b); G[b].push_back(a); } dfs(0, -1); seg.init(n); rep(i, k)seg.upd(i, a[i]-1); rep(i, q) { int t; cin >> t; if (t == 1) {//変更 int b, x; cin >> b >> x; assert(1 <= b&&b <= k && 1 <= x&&x <= n); seg.upd(b - 1, x - 1); } else if(t==2){//集会 int l, r; cin >> l >> r; assert(1 <= l&&l <= r&&r <= k); cout << c[seg.get(l - 1, r)] << endl; } else assert(0); } }