#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) #define all(x) begin(x), end(x) template bool chmin(T& x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T& x, T y) { return x < y ? (x = y, true) : false; } using mint = atcoder::modint998244353; void solve() { int q; cin >> q; vector v; int m = 100; auto add = [&]() { char c; cin >> c; if (c == '(') v.push_back(1); else if (c == '|') { if (!v.empty() && v.back() == 1) v.back()++; else v.push_back(m + 1); } else if (c == ')') { if (!v.empty() && v.back() == 2) v.pop_back(); else v.push_back(m + 1); } else assert(0); }; auto del = [&]() { if (v.empty()) v.push_back(2); else { v.back()--; if (v.back() == 0 || v.back() == m) v.pop_back(); } }; while (q--) { int t; cin >> t; if (t == 1) add(); else del(); if (v.empty()) cout << "Yes\n"; else cout << "No\n"; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(15); int t = 1; // cin >> t; while (t--) solve(); }