from collections import deque q=int(input()) score=deque() min_score=deque() ok=deque() for i in range(q): query=input().split() if query[0]=='1': c=query[1] if c=='(': if len(ok)>0 and ok[-1]==0: ok.append(0) else: ok.append(0) if len(score)>0: score.append(score[-1]+1) min_score.append(min_score[-1]) else: score.append(1) min_score.append(1) elif c==')': if len(ok)>0 and ok[-1]==0: ok.append(False) else: ok.append(True) if len(score)>0: score.append(score[-1]-1) min_score.append(min(score[-1],min_score[-1])) else: score.append(-1) min_score.append(-1) else: if score and score[-1]==0: ok.append(0) else: if len(ok)>0 and ok[-1]==1: ok.append(False) else: ok.append(True) if len(score)>0: score.append(score[-1]) min_score.append(min(score[-1],min_score[-1])) else: score.append(0) min_score.append(0) else: score.pop() min_score.pop() ok.pop() if len(score)==0 or (score[-1]==0 and min_score[-1]==0 and ok[-1]): print("Yes") else: print("No")