#!/usr/bin/python3 def puts(arr): res = ''.join(map(str, arr)) print(res, flush=True) a, b = input().split() return a, b res = [0] * 10 for i in range(10): arr = [] for j in range(10): res[i] = j a, b = puts(res) if int(a) == 10: exit(0) arr.append((a, j)) res[i] = max(arr)[1]