import sys S = "0000000000" print(S) old_ck, S = map(str, input().split()) print(S) i = 0 while True: ck, S = map(str, input().split()) ck = int(ck) if ck == 10: sys.exit() if old_ck == ck: M = int(S[i]) M += 1 S[i] = str(S[i]) elif old_ck < ck: i += 1 else: M = int(S[i]) M -= 1 S[i] = str(S[i]) i += 1 print(S)