Universal Cup Judging System

Universal Cup

時間限制: 3.0 s 記憶體限制: 1024 MB 總分: 100
统计

There is an undirected graph with $n$ vertices and $m$ edges. The graph does not contain self-loops or parallel edges and is not necessarily connected. The vertices are numbered from $1$ to $n$.

There are $q$ queries. Each query is a pair $(x, y)$. You need to determine whether the distance between $x$ and $y$ is strictly more than $20\,000$ or not.

The distance between two vertices is the number of edges on a shortest path between them. If there is no shortest path, the distance is considered to be $+\infty > 20\,000$.

Input

The first line contains three integers $n$, $m$, and $q$ ($1 \le n \le 10^5$, $0 \le m \le 3 \cdot 10^5$, $1 \le q \le 3 \cdot 10^5$).

Then follow $m$ lines, each containing two integers $u_i$ and $v_i$, representing the edges ($1 \le u_i < v_i \le n$, no two edges coincide).

After that follow $q$ lines, each containing two integers $x_i$ and $y_i$ ($1 \le x_i, y_i \le n$, $x_i$ and $y_i$ may coincide).

Output

Print $q$ lines, each with either "YES" or "NO": the answers to the queries.

Example

Sample Input 1

10 5 10
1 2
1 7
3 10
4 10
5 6
3 3
5 6
5 2
10 6
9 4
6 6
1 7
10 1
10 5
8 7

Sample Output 1

NO
NO
YES
YES
YES
NO
NO
YES
YES
YES

Note

In the example, there are just $10$ vertices in the graph, so we are checking whether the vertices are in different connected components or not.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.