import sys S = "0000000000" print(S) old_ck, S = map(int, input().split()) print(S) i = 0 while True: ck, S = map(int, input().split()) 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