from collections import deque D=deque() N=int(input()) S=list() for i in range(N): S=input().split() if S[0]=='1': D.appendleft(S[1]) else: D.append(S[1]) print(''.join(D))