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 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.