import ast def check(s): try: ast.parse(s.replace("(|)", "0").replace("|","+")) return "|" in s except: return 0 with open("/dev/stdin","r") as f: stdin = f.read() S = "" for q in stdin.split("\n")[1:]: if q.startswith("1"): S += q[2:] else: S = S[:-1] print("Yes" if check(S) else "No")