XOR Sum#6018

XOR Sum

1 second
128 megabytes
Very easy

You will be given a list of ( ≤ ≤ ) instructions.

If the instruction is to "insert n", insert into the list of numbers (there may be duplicates).

If the instruction is to "print" - print the XOR sum of the largest ( ≤ ≤ ) elements in the list (or, if the list contains less than elements, the XOR sum of all elements in the list).

XOR sum of a list of numbers is the result of XOR-ing all of them. XOR can be applied to two integers using the built in ^ operator in most languages (or xor in Haskell (Pascal)).

Note that XOR function has some useful properties, among them that if ^ = then = ^ and = ^ .

Input

First line contains the number ( ≤ ≤ ) of test cases. Each test case start with a line containing two integers and ( ≤ , ≤ ). Following are lines containing one instruction each.

Instructions are in either of the following two forms:

insert n

or

print

is a non-negative integer less than 2^{31}.

Output

For each print statement output the XOR sum of (at most) largest elements in the current list. Note that the list is cleared between test cases.

Examples

Example 1

Loading
Loading