#https://yukicoder.me/submissions/1160875 写経 import sys input = sys.stdin.readline Q = int(input()) A = [] X = [] D = {} for i in range(Q): q = input().split() if q[0] == '1': x = q[1] A.append(x) X.append((x, len(A) - 1)) if len(X) >= 3 and X[-1][0] == ')' and X[-2][0] == '|' and X[-3][0] == '(': a = X.pop() b = X.pop() c = X.pop() D[a[1]] = (b, c) else: k = A.pop() if X and X[-1][0] == k and X[-1][1] == len(A): # 復元不要 X.pop() else: X.append(D[len(A)][1]) X.append(D[len(A)][0]) if X == []: print('Yes') else: print('No')