시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB124327.273%

문제

Anya is going to be an operator at the laboratory today. The operator's desk has one million switches, no kidding! The switches are numbered by integers from $1$ to $10^6$, and each switch corresponds to a device with the same number. The switches don't show whether the respective devices are on or off, but it is known that toggling a switch changes the state from "on" to "off" and from "off" to "on".

When Anya arrives in the morning, all devices are off. After that, fellow workers come and occasionally toggle the switches.

To optimize energy consumption, after each toggle, the operator has to distinguish between the following classes of states:

  • all devices are off,
  • exactly one device is on: it is necessary to know which one,
  • two or more devices are on.

Sure enough, Anya will be able to do this. But then she will have to transfer the operator duty to her friend Andrei. And during the transfer, she may only leave a short note to him. After reading the note, Andrei will have the exact same task: fellow workers will toggle the switches, and he will have to know the current class of states of the laboratory.

Help the friends devise a way to write the note so that not only Anya, but also Andrei has all the necessary information after each toggle.

인터랙션

In this problem, your solution will be run twice on each test. In each test, all toggles during both runs are fixed in advance. Each line of input is terminated by an end-of-line character.

첫 번째 실행

During the first run, the solution acts for Anya. The first line contains the word "start". The second line contains an integer $n$, the number of toggles ($1 \le n \le 100\,000$). Each of the following $n$ lines contains one integer: the number of the device (from $1$ to $10^6$) for which a worker toggled the switch.

For each toggle, print a line with a single integer:

  • 0 if all devices are off,
  • the number of the device that is on, if there is exactly one such device,
  • -1 if two or more devices are on.

After all the answers, print a single line containing the note Anya will leave to Andrei. The note must have length from $0$ to $1000$ characters and consist only of characters with ASCII codes from $32$ to $126$. There are no other restrictions on the note's contents.

두 번째 실행

During the second run, the solution acts for Andrei. The first line contains the word "resume". The second line contains the note, exactly as it was printed during the first run. The third line contains an integer $m$, the number of toggles ($1 \le m \le 100\,000$). Each of the following $m$ lines contains one integer: the number of the device (from $1$ to $10^6$) for which a worker toggled the switch.

For each toggle, print a line with a single integer, following the same rules as during the first run.

예제

For each test, the input during the second run depends on the solution's output during the first run.

Below we show two runs of a certain solution on the first test.

예제 입력 1

start
5
10
14
10
12
10

예제 출력 1

10
-1
14
-1
-1
3  10 12 14

예제 입력 2

resume
3  10 12 14
6
14
277
12
10
277
12

예제 출력 2

-1
-1
-1
277
0
12

채점 및 기타 정보

  • 예제는 채점하지 않는다.