n = int(input()) ans = "" for _ in range(n): t,s = input().split() if t == "0": ans += s elif t == "1": ans = s + ans print(ans)