영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
시간 제한 1초 · 메모리 제한 512 MB
Problem
There are n cities and m roads between them. Kaaleppi is currently in city a and wants to travel to city b.
However, there is a problem: Kaaleppi has recently robbed a bank in city c and can't enter the city, because the local police would catch him. Your task is to find out if there is a route from city a to city b that does not visit city c.
As an additional challenge, you have to process q queries where a, b and c vary.
Input
The first input line has three integers n, m and q: the number of cities, roads and queries. The cities are numbered 1,2,…,n.
Then, there are m lines describing the roads. Each line has two integers a and b: there is a road between cities a and b. Each road is bidirectional.
Finally, there are q lines describing the queries. Each line has three integers a, b and c: is there a route from city a to city b that does not visit city c?
You can assume that there is a route between any two cities.
Output
For each query, print "YES", if there is such a route, and "NO" otherwise.
Constraints
- 1 ≤ n ≤ 10^5
- 1 ≤ m ≤ 2 · 10^5
- 1 ≤ q ≤ 10^5
- 1 ≤ a,b,c ≤ n
예제
예제 1
5 6 3 1 2 1 3 2 3 2 4 3 4 4 5 1 4 2 3 5 4 3 5 2
YES NO YES