Write a program that determines whether one of two given vertices in a tree is an ancestor of the other.
The first line contains an integer (1 \le n \le 10^5), the number of vertices in the tree.
The second line contains integers, where the -th number represents the parent of the vertex numbered . If the value is , the vertex is the root of the tree.
The third line contains an integer (1 \le m \le 10^5), the number of queries.
Each of the following lines contains two distinct integers and (1 \le a, b \le n), representing a query.
For each of the queries, print on a separate line if vertex is an ancestor of vertex , and otherwise.

Example 1