w = "" for _ in range(int(input())): a,b = input().split() if a == "1": w = b+w else: w += b print(w)