#P1464F. My Beautiful Madness
My Beautiful Madness
No submission language available for this problem.
Description
You are given a tree. We will consider simple paths on it. Let's denote path between vertices and as . Let -neighborhood of a path be a set of vertices of the tree located at a distance from at least one vertex of the path (for example, -neighborhood of a path is a path itself). Let be a multiset of the tree paths. Initially, it is empty. You are asked to maintain the following queries:
- — add path into ().
- — delete path from (). Notice that equals to . For example, if , than after query , .
- — if intersection of all -neighborhoods of paths from is not empty output "Yes", otherwise output "No" ().
The first line contains two integers and — the number of vertices in the tree and the number of queries, accordingly (, ).
Each of the following lines contains two integers and — indices of vertices connected by -th edge ().
The following lines contain queries in the format described in the statement.
It's guaranteed that:
- for a query , path (or ) is present in ,
- for a query , ,
- there is at least one query of the third type.
For each query of the third type output answer on a new line.
Input
The first line contains two integers and — the number of vertices in the tree and the number of queries, accordingly (, ).
Each of the following lines contains two integers and — indices of vertices connected by -th edge ().
The following lines contain queries in the format described in the statement.
It's guaranteed that:
- for a query , path (or ) is present in ,
- for a query , ,
- there is at least one query of the third type.
Output
For each query of the third type output answer on a new line.