Are Two Vertices Reachable in a Graph?

You are given an undirected graph with v vertices and e edges. There are q queries asking you to check if two vertices are reachable, meaning one can get from one vertex to another by traversing the graph.

Input

The first line of the input contains two integers v (1 ≀ v ≀ 1000) and e (1 ≀ e ≀ 1000).
The following e lines contain pairs of integers v1, v2 (1 ≀ v1, v2 ≀ v) which means that the vertex v1 is connected to the vertex v2 and vice versa.
The next line contains a single integer q (1 ≀ q ≀ 100) the number of queries.
The following q lines contain pairs of integers q1, q2 (1 ≀ q1, q2 ≀ v) the query vertices.

Output

For each of the queries, the program should print Yes if one can get from the vertex q1 to q2, and No otherwise.

Examples

Input
Output
7 6 1 2 2 3 1 3 4 5 5 6 4 6 4 1 2 2 5 3 6 4 6
Yes No No Yes
Β 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue