n=int(input()) ans="" for i in range(n): t,s = map(str,input().split()) if t=="0": ans = ans + s else: ans = s + ans print(ans)