eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Job or joy

Job or joy

Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB

How much time can you solve problems non-stop? Sometimes you want to rest, but now is just not the time. It is necessary to collect your thoughts in a fist and snatch victory from your rivals.

This problem is designed to separate the merely good teams from the Champions, those who expect to get into the top ten from those who do not intend to take a place below the first. Since the number of enemies who are going to find the author of this tightly introduction to express what they think about him, grows, let’s get down to business. An undirected graph is given. Some queries follow. A query is a pair of vertices.

For each query, find out if there exist at least three edge-disjoint paths from the first vertex to the second.

Вхідні дані

In first line there are two integers n and k (1n, k100000) — number of vertices and edges in the graph. The next k lines describe edges by pair of connected vertices a, b (1a, bn). Edges connect different vertices and there is at most one edge between any two vertices. In the next line, there is number of queries q (0q100000). Each of the next q lines contains two integers a, b (a 6 = b, 1a, bn) — pair of vertices for which it is required to find out if there exist three distinct paths between them such that none of them share an edge.

Вихідні дані

For each query, output a single line with either Yes if such three paths exist, or No otherwise.

Приклад

Вхідні дані #1
6 9
1 2
1 5
1 4
1 6
2 3
3 4
3 5
4 5
4 6
9
1 2
1 3
1 5
2 4
5 6
3 6
3 4
2 6
2 3
Вихідні дані #1
No
Yes
Yes
No
No
No
Yes
No
No
Джерело ЛКШ-2011 Севастополь 08.08.2011 д.1 Высшая лига