Q = int(input()) class Stack: def __init__(self, val, next) -> None: self.val = val self.next = next stack = [(0, 0)] for _ in range(Q): text = input() if text[0] == "2": stack.pop() else: c = text[-1] s, v = stack[-1] ns = -1 nv = -1 if s == -1: pass elif s == 0: if c == "(": ns = 1 nv = Stack(1, 0) elif s == 1 or s == 3: if c == "|": ns = 2 nv = v elif c == "(" and s == 1: ns = 1 nv = Stack(0, v) elif s == 2 or s == 4: if c == ")": nv = v.next if nv == 0: ns = 99999 elif v.val == 0: ns = 3 else: ns = 4 elif c == "(" and s == 2: ns = 1 nv = Stack(1, v) stack.append((ns, nv)) if stack[-1][0] == 99999: print("Yes") else: print("No")