Multiset Updates and Membership
Maintain a multiset under updates and membership queries.
Input
The first line contains n and the n initial integers. The next line contains q. Each query is 1 x (insert one x), 2 x (erase one x if present), or 3 x (test membership).
Array and query counts are between $1$ and $10^5$. Integer values are between $-10^9$ and $10^9$. Deleting a missing multiset value has no effect.
Output
For every type 3 query, print YES if at least one x is present and NO otherwise.
Example
Input
6
1 2 3 4 5 6
4
1 1
2 6
3 1
3 6
Output
YES
NO
Comments