Q = int(input()) 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 = 1 elif s == 1 or s == 3: if c == "|": ns = 2 nv = v elif c == "(" and s == 1: ns = 1 nv = v * 2 elif s == 2 or s == 4: if c == ")": nv = v // 2 if nv == 0: ns = 99999 elif v % 2 == 0: ns = 3 else: ns = 4 elif c == "(" and s == 2: ns = 1 nv = v * 2 + 1 stack.append((ns, nv)) if stack[-1][0] == 99999: print("Yes") else: print("No")