#include using namespace std; const int N = 800005; int st[N], par[N], dep[N]; char ch[N]; int main() { cin.tie(0)->sync_with_stdio(0); int q; if (!(cin >> q)) return 0; int p = 0; st[0] = dep[0] = 0; while (q--) { int t; cin >> t; if (t == 1) { char c; cin >> c; p++; int u = st[p - 1]; if (c == ')' && dep[u] >= 2 && ch[u] == '|' && ch[par[u]] == '(') { st[p] = par[par[u]]; } else { st[p] = p; ch[p] = c; par[p] = u; dep[p] = dep[u] + 1; } } else { p--; } cout << (dep[st[p]] == 0 ? "Yes\n" : "No\n"); } return 0; }