""" ばかでごめんなさい """ 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) sl = 0 top = 0 for i in range(q): qry = list(input().split()) if qry[0] == "1": c = qry[1] st[top] = c top += 1 if st[top-3:top] == ["(", "|", ")"]: top -= 3 sl += 1 h[sl] = top else: sl -= 1 top = h[sl] print("Yes" if top == 0 else "No")