import sys input = sys.stdin.readline Q = int(input()) p = [0] s = [0] t = [0] ok = [1] for _ in range(Q): q = input().split() if q[0] == '1': x = t[-1] y = ok[-1] c = q[1] if y: if c == '(': p.append(x) s.append(0) x = len(s) - 1 elif c == '|': if x and s[x] == 0: p.append(p[x]) s.append(1) x = len(s) - 1 else: y = 0 else: if x and s[x] == 1: x = p[x] else: y = 0 t.append(x) ok.append(y) else: t.pop() ok.pop() print('Yes' if ok[-1] and t[-1] == 0 else 'No')