import sys #N = int(input()) N = int(sys.stdin.readline()) lst = [] ans = '' for i in range(N): #T,S = input().split(' ') T,S = sys.stdin.readline().strip().split(' ') if T == '0': ans += S else: ans = S + ans print(ans)