#GYM104664G. Spaghetti Game

Spaghetti Game

Description

The infamous hat-wearing pasta-making brothers, Lario and Muigi, have decided to settle their rivalry once and for all with a game of wits – and spaghetti.

The game works as follows: Lario and Muigi take turns modifying a pile of spaghetti.

Lario goes first. Lario can make $n$ different types of spaghetti bundles, where the $i$th type of bundle contains $a_i$ strands of spaghetti. On his turn, Lario can choose a type of spaghetti bundle to make, adding $a_i$ strands to it.

Muigi is trying to assemble his own $m$ types of spaghetti bundles, where the $j$th type of bundle contains $b_j$ strands of spaghetti. On his turn, Muigi can take $b_j$ strands from the pile to assemble a spaghetti bundle of his own, as long as the pile has at least $b_j$ strands to begin with.

Note that either brother can choose to skip their turn by adding or removing $0$ strands from the pile.

The game lasts 100 rounds. If Lario can get the pile to have at least $t$ strands of spaghetti in that time, then he wins the spaghetti game. Otherwise, Muigi wins, having successfully stopped Lario.

Here's where you come in: You are the maddest hatter, and have the ability to mind control anyone wearing a hat. You don't really care which brother comes out on top, but you do love chaos and winning. In fact, you're set on taking over one of Lario and Muigi, and leading them to victory. Are you up to the task?

Note that this is an interactive problem, which has different input / output format. Read below for details.

Interaction

The first line of input contains three integers, $n$, $m$, and $t$ ($1 \leq n, m, t \leq 100$). $n$ and $m$ are the number of Lario's bundles and Muigi's bundles, respectively. $t$ is the number of strands in the pile for Lario to win.

The second line contains $n$ integers, $a_1, \ldots, a_n$ ($1 \leq a_i \leq 100$), representing the number of strands in each of Lario's bundles.

The third line contains $m$ integers, $b_1, \ldots, b_m$ ($1 \leq b_j \leq 100$), representing the number of strands in each of Muigi's bundles.

Afterwards, your program should output either "Lario" or "Muigi", depending on which brother you would like to take control of. To pass the test case, you must win as your chosen brother.

Then, you will play the spaghetti game with the judge. When it is your turn, you must output a single integer on its own line; if you are Lario, it must be some $a_i$ (or $0$), and if you are Muigi, it must be some $b_j$ (or $0$). Otherwise, you will receive Wrong Answer as a verdict. When it is the judges turn, they will output one of $a_i$ (or $0$) if they are Lario, or one of $b_j$ (or $0$) if they are Muigi.

The game will automatically end once the pile has at least $t$ strands, or 100 rounds have passed (that is, both Lario and Muigi have each taken 100 actions). Your program should terminate once this happens, otherwise you may get undefined verdicts.

Remember to flush your output after printing each move. This can be done with cout.flush() in C++, System.out.flush() in Java, and stdout.flush() in Python.

3 3 20
3 6 15
2 8 15


0

8

2
Lario
6

6

3

15

Note

In this example, you control Lario. The game plays as follows:

  • Lario adds 6 strands to the pile. The pile has 6 strands of spaghetti.
  • Muigi skips his turn. The pile has 6 strands of spaghetti.
  • Lario adds 6 strands to the pile. The pile has 12 strands of spaghetti.
  • Muigi removes 8 strands from the pile. The pile has 4 strands of spaghetti.
  • Lario adds 3 strands to the pile. The pile has 7 strands of spaghetti.
  • Muigi removes 2 strands from the pile. The pile has 5 strands of spaghetti.
  • Lario adds 15 strands from the pile. The pile has 20 strands of spaghetti, so Lario wins.