| 316 | } |
| 317 | |
| 318 | public static void main(String[] args) throws Exception { |
| 319 | FastReader in = new FastReader(System.in); |
| 320 | PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); |
| 321 | n = in.nextInt(); |
| 322 | m = in.nextInt(); |
| 323 | for (int i = 1; i <= n; i++) { |
| 324 | arr[i] = in.nextInt(); |
| 325 | } |
| 326 | for (int i = 1, u, v; i < n; i++) { |
| 327 | u = in.nextInt(); |
| 328 | v = in.nextInt(); |
| 329 | addEdge(u, v); |
| 330 | addEdge(v, u); |
| 331 | } |
| 332 | // dfs1(1, 0); |
| 333 | // dfs2(1, 1); |
| 334 | dfs3(1, 0); |
| 335 | dfs4(1, 1); |
| 336 | centroidTree(getCentroid(1, 0), 0); |
| 337 | for (int i = 1; i <= n; i++) { |
| 338 | add(i, arr[i]); |
| 339 | } |
| 340 | int lastAns = 0; |
| 341 | for (int i = 1, op, x, y; i <= m; i++) { |
| 342 | op = in.nextInt(); |
| 343 | x = in.nextInt(); |
| 344 | y = in.nextInt(); |
| 345 | x ^= lastAns; |
| 346 | y ^= lastAns; |
| 347 | if (op == 0) { |
| 348 | lastAns = query(x, y); |
| 349 | out.println(lastAns); |
| 350 | } else { |
| 351 | add(x, y - arr[x]); |
| 352 | arr[x] = y; |
| 353 | } |
| 354 | } |
| 355 | out.flush(); |
| 356 | out.close(); |
| 357 | } |
| 358 | |
| 359 | // 读写工具类 |
| 360 | static class FastReader { |