Volcanoes are erupting over the ovine homeland! Help the Sheep King escape the lava.
There are $$$n$$$ islands connected by $$$m$$$ undirected bridges. Each bridge has a length $$$w$$$: crossing that bridge takes exactly $$$w$$$ days (for both the sheep and the lava).
Each island $$$i$$$ has a volcano that erupts on day $$$a_i$$$. When a volcano erupts, all bridges connected to that island burn down and become unusable.
Lava spreads through the bridge network over time, using the same travel times as the Sheep King (it needs $$$w$$$ days to cross a bridge of length $$$w$$$). If lava reaches an island before its volcano erupts, that island burns at the moment lava arrives.
The Sheep King starts on island $$$1$$$ at day $$$0$$$ and wants to reach island $$$n$$$ to escape. If he arrives at an island exactly when it burns, he is considered safe and may still depart from it at that time.
The first line contains an integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases.
For each test case:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$, and the sum of $$$m$$$ over all test cases does not exceed $$$10^5$$$.
For each test case, print Yes (case-insensitive) if it is possible to travel from island $$$1$$$ to island $$$n$$$. Otherwise, print No (case-insensitive).
13 2100 2 1001 2 22 3 2
YES
25 746 34 5 60 361 3 231 3 291 5 72 5 254 5 84 5 114 5 295 725 53 5 49 71 2 41 4 71 5 232 5 232 5 243 4 124 5 20
YESNO
The Sheep King can travel from island $$$1$$$ to island $$$2$$$ in $$$2$$$ days. He arrives at island $$$2$$$ on day $$$2$$$, exactly when it burns. He is still safe, so he can continue to island $$$3$$$ and arrive there on day $$$4$$$. The answer is Yes.