#!/usr/bin/env python3
from sys import exit, stderr

n = int(input())

while type(n) is int and n > 0:
    remainder = n % 4
    if remainder == 1: 
        print("I give up", flush=True)
        exit(0)
    else:
        to_subtract = (remainder - 1) % 4
        n -= to_subtract
        print(f"{to_subtract}", flush=True)

    oppnent_move = input().strip()
    if oppnent_move == "I give up":
        exit(0)
    oppnent_move = int(oppnent_move)
    if (oppnent_move not in [1, 2, 3]):
        print("Opponent made illegal move", file=stderr, flush=True)
        exit(1)
    n -= int(oppnent_move)
    if (n < 0):
        print("Opponent picked more coins than what's available", file=stderr, flush=True)
        exit(1)
