def func(n): s = "0" * 10 print(s) base, _ = input().split() for i in range(1, 10): print(s[:n] + str(i) + s[n + 1:]) x, _ = input().split() if int(x) > int(base): return i return 0 def main(): print("0" * 10) if "unlocked" in input(): return ans = "" for i in range(10): ans += str(func(i)) print(ans) if __name__ == '__main__': main()