N=int(input()) ans="" Ans="" for i in range(N): s = input() if s[0] == "0": ans+=s[2] else: Ans+=s[2] print(Ans[::-1]+ans)