p = 0 rem = {} st = [] Q = int(input()) for _ in range(Q): qs = input().split() if qs[0] == '1': c = qs[1] st.append(c) if len(st) >= 3 and st[-3] == '(' and st[-2] == '|' and st[-1] == ')': rem[p] = True st.pop() st.pop() st.pop() else: rem[p] = False p += 1 elif qs[0] == '2': p -= 1 if rem[p]: st.append('(') st.append('|') else: st.pop() else: assert False if len(st) == 0: print('Yes') else: print('No')