#icpc2013summerwarmingUpd. [icpc2013summer_warmingUp_d]Graph Destruction
[icpc2013summer_warmingUp_d]Graph Destruction
Description
Given a simple undirected graph with vertices and edges, process a sequence of queries of two types:
- Delete an edge
- Output whether there exists a path between vertex and
Input
The first line of the input file contains the integers , and (), separated by a space.
The next lines describe the edges. The -th of these lines describes edge and it contains the integers and (), separated by a space. Edge connects vertex and . The vertices are labeled to .
The next lines describe the queries. Each query is either of the following two forms:
0 e
: delete an edge (, and each edge never appears twice)1 v w
: output whether there exists a path between and ()
Output
For each query of the 2nd type, print YES
or NO
, one per line, in the same order that the queries appear in the input file.
Sample Input
4 4 5
1 2
2 3
3 1
1 4
1 1 4
0 4
1 2 4
0 1
1 1 2
Sample Output
YES
NO
YES