""" ばかでごめんなさい """ from math import isqrt import sys mod = 998244353 input = sys.stdin.readline II = lambda : int(input()) MI = lambda : (int(_) for _ in input().split()) LI = lambda : list(int(_) for _ in input().split()) q = II() st = [""] * (q + 1) h = [0] * (q + 1) op = [] top = 0 for i in range(q): qry = list(input().split()) if qry[0] == "1": c = qry[1] op.append((top, st[top])) st[top] = c top += 1 if top >= 3 and st[top-3:top] == ["(", "|", ")"]: top -= 3 h[len(op)] = top else: idx, p = op.pop() st[idx] = p top = h[len(op)] print("Yes" if top == 0 else "No")