query = [] for i in range(int(input())): q = input().split() if q[0] == "2": query.append("-1") else: query.append(q[1]) S = [] for q in query: if q == "-1": S.pop() else: S.append(q) stk2 = [] for c in S: stk2.append(c) if len(stk2) >= 3 and stk2[-1] == ")" and stk2[-2] == "|" and stk2[-3] == "(": stk2.pop() stk2.pop() stk2.pop() print("No" if len(stk2) else "Yes")