import sys input = sys.stdin.readline Q = int(input()) st = [] st2 = [] for _ in range(Q): qs = input().split() match qs: case ('1', ')'): if len(st) >= 2 and st[-2] == '(' and st[-1] == '|': st.pop() st.pop() st2.append(True) else: st.append(')') st2.append(False) case ('1', C): st.append(C) st2.append(False) case ('2',): if st2.pop(): st.append('(') st.append('|') else: st.pop() case _: assert False if len(st) == 0: print('Yes') else: print('No')