#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; #define rep(i,n) for(ll i=0;i T div_floor(T a, T b) { return a / b - ((a ^ b) < 0 && a % b); } template T div_ceil(T a, T b) { return a / b + ((a ^ b) > 0 && a % b); } template inline bool chmin(T &x, U y) { return (y < x) ? (x = y, true) : false; } template inline bool chmax(T &x, U y) { return (x < y) ? (x = y, true) : false; } template ostream &operator<<(ostream &os, const vector &a){ if (a.empty()) return os; os << a.front(); for (auto e : a | views::drop(1)){ os << ' ' << e; } return os; } void dump(auto ...vs){ ((cout << vs << ' '), ...) << endl; } void solve() { ll Q; cin>>Q; ll cor=0; vector P; ll len=0; string S; rep(_,Q){ ll t; cin>>t; if (t==1){ char c; cin>>c; S.push_back(c); if (len>cor){ len++; } else{ if (c=='('){ P.push_back(0); cor++; } else if (c=='|'){ if (P.size()>0 and P.back()==0){ P.back()=1; cor++; } } else if (c==')'){ if (P.size()>0 and P.back()==1){ P.pop_back(); cor++; } } len++; } } else{ if (len>cor){ len--; S.pop_back(); } else{ if (S.back()=='('){ P.pop_back(); } else if (S.back()=='|'){ P.back()--; } else if (S.back()==')'){ P.push_back(1); } len--; cor--; S.pop_back(); } } if (P.empty() and (cor==len)){ cout<<"Yes"<<'\n'; } else{ cout<<"No"<<'\n'; } } return; } int main() { cin.tie(0)->sync_with_stdio(0); ll T=1; while (T--){ solve(); } return 0; }