n=int(input()) s='' for _ in [0]*n: f,c=input().split() if f=='0': s=s+c else: s=c+s print(s)