q = int(input()) st = [] d = [] for _ in range(q): x = input() if x[0] == '1': _, c = x.split() st.append(c) if len(st) >= 3 and st[-3] == '(' and st[-2] == '|' and st[-1] == ')': for _ in range(3): st.pop() d.append(1) else: d.append(0) else: if d.pop() == 1: st.append('(') st.append('|') else: st.pop() if len(st) == 0: print('Yes') else: print('No')