q = int(input()) s = [] f = dict() n = 0 for _ in range(q): c = input() if c[0] == "1": c = c[-1] n += 1 s.append(c) if len(s) >= 3 and s[-3] == "(" and s[-2] == "|" and s[-1] == ")": s.pop() s.pop() s.pop() if len(s) == 0: f[n] = True else: f[n] = False else: n -= 1 print("Yes" if f[n] else "No")