Given a rooted tree, answer queries of the form: is vertex an ancestor of vertex ?
The first line contains an integer n~(1 \le n \le 10^5) — the number of vertices in the tree.
The second line contains integers: the -th of them is the parent of vertex . For the root of the tree, this number is .
The third line contains an integer m~(1 \le m \le 10^5) — the number of queries.
Each of the next lines contains two distinct integers and b~(1 \le a, b \le n) describing a query.
For each query, print on a separate line if vertex is an ancestor of vertex , and otherwise.

Example 1