시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 2048 MB64958.929%

문제

This is an interactive run-twice problem.

What is a game without a little gambling? But wait... we're serious people here, and gambling is not for us! Instead, let's dive into the world of encryption algorithms. However, to keep things intriguing, we will introduce a new encryption algorithm that uses randomness derived from rolling dice!

You will be given a number $x$ ranging from $0$ to $10^{100}$. Your task is to encrypt this number through a series of dice rolls and then decrypt it to return to the original value.

The encryption process consists of exactly $18\,500$ steps. At each step, you will be given three six-faced dice. The dice are fair: all faces have an equal probability of being selected. Each face of each die displays an integer from $0$ to $9$ selected uniformly at random, independently of the others. You will then select one of the three given dice. After that, the jury will roll your chosen die once, and record the outcome.

인터랙션 프로토콜

The program will run two times.

In the first run, the first line contains the number $1$. Then the jury's program prints a line with the number $x$ ($0 \leq x \leq 10^{100}$). After that, exactly $18\,500$ steps happen. In each step:

  • The jury's program outputs a line with $18$ integers, each ranging from $0$ to $9$. The first $6$ integers describe the faces of the first die, the next $6$ represent the second die, and the last $6$ correspond to the third die.
  • Your task is to select one of the three dice by printing a line with an integer from $1$ to $3$.
  • The jury's program then prints a line with the outcome of the roll from the die you chose.

In every test, the jury's program produces the same output for the same input.

In the second run, the first line contains the number $2$. Then the jury's program provides a single line without spaces containing the results of the $18\,500$ rolls in the same order as the first run. The participant's program should then output the original number $x$ and terminate.

예제 입력 1

1
1
2 1 8 2 5 9 2 8 2 6 2 9 9 0 3 8 5 7

2
0 9 7 2 9 3 2 5 5 2 0 6 8 8 8 4 9 4

6
0 9 9 9 7 7 0 7 6 6 6 0 4 6 9 2 5 3

3
4 2 9 2 1 2 2 7 0 5 3 5 5 0 5 8 3 1

9
3 0 7 7 6 7 0 4 8 1 2 5 0 0 9 1 2 9

0
4 9 3 1 5 7 9 3 7 5 9 2 6 9 2 6 9 5

6
7 4 3 6 5 2 3 0 2 2 5 8 3 5 0 7 7 4

3
2 2 0 2 4 3 3 0 8 4 4 7 6 9 8 3 6 2

8
5 3 9 9 3 3 1 4 0 5 2 4 1 8 6 6 4 3

4
3 2 4 6 0 2 5 8 8 1 4 8 3 9 1 5 6 6

8

예제 출력 1




1


2


3


1


2


3


1


2


3


2

예제 입력 2

2
2639063848

예제 출력 2



1

노트

The example contains only $10$ steps. This is only to demonstrate the format of input and output. During system testing, there will be exactly $18\,500$ steps.

채점 및 기타 정보

  • 예제는 채점하지 않는다.
  • 이 문제의 채점 우선 순위는 3이다.