from sys import stdin n=int(input()) s=[] for _ in [0]*n: f,c=stdin.readline().split() s.append(c) if f=='0' else s.insert(0,c) print(''.join(s))