N = int(input()) ans = "" for i in range(N): T, S = map(str, input().split()) if T == "1": ans = S + ans else: ans += S print(ans)