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 s[-3:] == ["(","|",")"]: 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")