stk = [] Q = [0,0,0] def f(Q): if not Q[0]: return Q[0] -= 1 q = input().split() erased = False if q[0] == "1": c = q[1] stk.append(c) if len(stk) >= 3 and c == ")": if stk[-1] == ")" and stk[-2] == "|" and stk[-3] == "(": erased = True stk.pop() stk.pop() stk.pop() print("No" if len(stk) else "Yes") Q[2] += 1 f(Q) if erased: stk.append("(") stk.append("|") stk.append(")") stk.pop() if Q[2] < Q[1]: print("No" if len(stk) else "Yes") Q[2] += 1 f(Q) Q[0] = int(input()) Q[1] = Q[0] f(Q)