def check(s): while True: s = s.replace("(|)", "") if "(|)" not in s: return s == "" S = "" for i in range(int(input())): q = input() if q.startswith("1"): S += q[2:] else: S = S[:-1] print("Yes" if check(S) else "No")