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