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