l = list("0000000000") while True: print "".join(l) x,state = raw_input().split(" ") x = int(x) if (state == "unlocked"): break new_l = [] for i in range(10): _l = [] + l _l[i] = str((int(l[i]) + 1 ) % 10) print "".join(_l) y,state = raw_input().split(" ") y = int(y) if (x == y ): new_l.append(str((int(_l[i]) + 1 ) % 10 )) elif (x < y ): new_l.append(_l[i]) else: new_l.append(l[i]) l = new_l