- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi has tiles each consisting of a single integer from to . Since he likes working with ceramics, he wants to combine these tiles into a tile he thinks is more artistic. But when firing a tile, it might break if it contains too many small integers. So Uolevi sometimes wants to know how many small integers a tile contains. To prevent breaking, Uolevi might need to split a tile into two tiles, the other containing smaller and the other larger integers.
More specifically, Uolevi wants to perform three types of queries:
- : Combine tiles indexed and into a single tile with index . It is guaranteed that tiles with indexes and exist.
- Split the tile with index into two tiles and , such that tile contains the smallest integers from the original tile, and the other tile contains the rest. It is guaranteed that both resulting tiles will be nonempty, a tile with index exists, and no tile with index exists.
- : How many integers in tile are at most ? It is guaranteed that a tile with index exists.
Initially every integer is in its own tile, and the index of integer 's tile is .
Input
The first line contains two integers : The amount of integers and queries.
lines follow, each being a query of one of the three types as described above:
Output
Output the answer to every query of type .
Constraints
Example
Input:
4 8 1 1 3 1 2 4 3 1 2 3 2 1 1 1 2 3 1 3 2 1 4 2 3 4 4
Output:
1 0 3 2