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