QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 512 MB 總分: 100

#18778. Sequence and Query 20

统计

There is an array $A$ that contains a single $0$. Then, the following queries need to be executed:

  • 1 x: Add $x$ to $A$.
  • 2 x: Remove $x$ from $A$. If $A$ contains two or more copies of $x$, remove only one. It is guaranteed that $x$ exists in $A$ when this query is executed.
  • 3 x: For each element in $A$, perform a bitwise XOR with $x$, then output the maximum value among them.

Input

The first line contains an integer $M$ $(1 \le M \le 200{,}000)$, the number of queries. The next $M$ lines each describe one query. All $x$ given in the input are non-negative integers not exceeding $10^9$.

Query type 3 appears at least once.

Output

Output the results of the queries in order.

Examples

Input 1

10
1 8
1 9
1 11
1 6
1 1
3 3
2 8
3 3
3 8
3 11

Output 1

11
10
14
13

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.