# -*- coding: utf-8 -*- """ No.305 鍵(2) https://yukicoder.me/problems/no/305 """ import sys from sys import stdin input = stdin.readline def check_keys(numbers): for n in numbers: print(n, end='') print('\n', flush=True) res, _ = input().split() return int(res) def main(args): numbers = [0] * 10 prev_res = check_keys(numbers) for keta in range(10): if prev_res == 10: break for i in range(10): numbers[keta] = i res = check_keys(numbers) if res > prev_res: prev_res = res break elif res < prev_res: numbers[keta] -= 1 break if __name__ == '__main__': main(sys.argv[1:])