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