import sys input = sys.stdin.readline def main(): Q = int(input()) phase_stack = [] error_count = 0 # 0=PUSH, 1=FLIP, 2=POP, 3=ERR history = [] out = [] for _ in range(Q): line = input().split() if line[0] == '1': c = line[1] if c == '(': phase_stack.append(0) history.append(0) elif c == '|': if phase_stack and phase_stack[-1] == 0: phase_stack[-1] = 1 history.append(1) else: error_count += 1 history.append(3) else: if phase_stack and phase_stack[-1] == 1: phase_stack.pop() history.append(2) else: error_count += 1 history.append(3) else: last = history.pop() if last == 0: phase_stack.pop() elif last == 1: phase_stack[-1] = 0 elif last == 2: phase_stack.append(1) else: error_count -= 1 out.append("Yes" if error_count == 0 and not phase_stack else "No") sys.stdout.write('\n'.join(out) + '\n') main()