#424
Unrated
Cow Land
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Cow Land is a special amusement park for cows, where they roam around, eat delicious grass, and visit different cow attractions (the roller cowster is particularly popular).

There are a total of NN different attractions (2N1052 \leq N \leq 10^5). Certain pairs of attractions are connected by pathways, N1N-1 in total, in such a way that there is a unique route consisting of various pathways between any two attractions. Each attraction ii has an integer enjoyment value eie_i, which can change over the course of a day, since some attractions are more appealing in the morning and others later in the afternoon.

A cow that travels from attraction ii to attraction jj gets to experience all the attractions on the route from ii to jj. Curiously, the total enjoyment value of this entire route is given by the bitwise XOR of all the enjoyment values along the route, including those of attractions ii and jj.

Please help the cows determine the enjoyment values of the routes they plan to use during their next trip to Cow Land.

입력

The first line of input contains NN and a number of queries QQ (1Q1051 \leq Q \leq 10^5). The next line contains e1eNe_1 \ldots e_N (0ei1090 \leq e_i \leq 10^9). The next N1N-1 lines each describe a pathway in terms of two integer attraction IDs aa and bb (both in the range 1N1 \ldots N). Finally, the last QQ lines each describe either an update to one of the eie_i values or a query for the enjoyment of a route. A line of the form "1 ii vv" indicates that eie_i should be updated to value vv, and a line of the form "2 ii jj" is a query for the enjoyment of the route connecting attractions ii and jj.

In test data worth at most 50% of points, there will be no changes to the values of the attractions.

출력

For each query of the form "2 ii jj", print on a single line the enjoyment of the route from ii to jj.

예제 입력 1

5 5
1 2 4 8 16
1 2
1 3
3 4
3 5
2 1 5
1 1 16
2 3 5
2 1 5
2 1 3

예제 출력 1

21
20
4
20
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.