#Qua2306. TheBigFatDuck travel in Beijing
TheBigFatDuck travel in Beijing
Background
In the 2024 postgraduate recommendation process, TheBigFatDuck, having realized its dream, left hometown Hefei for the metropolis Beijing for the further study.
Description
After a tough course, TheBigFatDuck felt hungry and he'd like to find someting to eat.
The restaurants in Beijing form a tree structure, with a total of restaurants indexed from to . Each restaurant has a flavor value .
Now, TheBigFatDuck wants to know the index of the first restaurant with a flavor value greater than or equal to that he encounter on the path . It's important to note that during the process, some restaurants may update their dishes, resulting in modified flavor values.
Format
Input
The first line consists of two integers, and , representing the number of nodes in a tree and the number of operations.
The next lines contain two integers each, and , representing the edges of the tree .
Following that, there is a single line with integers, , indicating the initial taste values of each restaurant.
The next lines represent the operations. Each line starts with an integer , representing the type of operation.
- If , the next three integers, , denote that Mr. Big Duck wants to inquire the first restaurant on the path satisfied . If there is no such , the result of the inquiry is .
- If , the next two integers, , indicate that the restaurant with the number has updated its dish, and the new taste value is .()
Output
For each operation with , output the result of the inquiry.
Sample
8 5
1 2
1 3
2 4
2 5
3 6
3 7
7 8
3 4 5 6 7 8 9 10
1 3 7 9
1 1 5 4
2 4 0
1 4 3 5
1 4 8 10
7
2
3
8
Limitation
1s,128MB
In the end, TheBigFatDuck stopped in front of a LaoxiangJi.
"I still miss the familiar taste of Fei Xi Lao Mu Chicken Soup. Perhaps I'm longing for my college days."
"Now that I've finally achieved my dream, I've lost youthful sight of the past days. Was it worth it?"
Suddenly, TheBigFatDuck realized that he had nothing to commemorate or regret because TheHamster even did not exist. It was merely a figment of his imagination, even though it provided him encouragement and support, urging him to make changes.
"Perhaps I should say thank you to TheHamster, but regardless, it's time to wake up. This is the path I have chosen, and I must keep on going."
相关
在下列比赛中: