with open("/dev/stdin","r") as f: stdin = f.read() S = "" c = 0 b = 0 for q in stdin.split("\n")[1:]: if q.startswith("1"): S += q[2] if q[2] == "(": c += 1 elif q[2] == ")": c -= 1 if c < 0: b = len(S) else: if S[-1] == "(": c -= 1 elif S[-1] == ")": c += 1 if len(S)-1 < b: b = 0 S = S[:-1] print("Yes" if "()" not in S and c == 0 and not b and "||" not in S and not S.endswith("|") and not S.startswith("|") and S.count("|") == S.count("(") and ")|)" not in S and "(|(" not in S else "No", S)