def main(): n = int(input()) ans = "" for _ in range(n): t, s = input().split() if t == '0': ans += s else: ans = s + ans print(ans) if __name__ == "__main__": main()