Given a tree$$$^{[6]}$$$ with $$$n$$$ vertices, where the $$$i$$$-th vertex is labeled with a positive integer $$$a_i$$$. A tree is eggy when the greatest common divisor of all its vertex-values is equal to $$$1$$$.
You have to process $$$q$$$ queries as follows:
The first line contains a single integer $$$n$$$ ($$$2 \leq n \leq 10^5$$$) — denoting the number of vertices in the tree.
The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^{18}$$$) — representing the values of the vertices.
Each of the following $$$n - 1$$$ lines contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u, v \le n$$$, $$$u \neq v$$$) — denoting the indices of the vertices connected by an edge.
The next line contains a single integer $$$q$$$ ($$$1 \le q \le 10^5$$$) — representing the number of queries.
Each of the next $$$q$$$ lines contains two integers $$$i$$$ and $$$x$$$ ($$$1 \le i \le n, 1 \le x \le 10^{18}$$$).
It is guaranteed that the given edges form a tree.
After each query, print "YES" (without quotes) if there's any valid edge in the tree, and "NO" (without quotes) otherwise.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
22 21 241 32 11 22 2
No Yes Yes No
36 2 31 21 352 61 21 33 53 6
No Yes No Yes No