#include using namespace std; using ll = long long; const ll MOD = 998244353; int main() { ll Q; cin >> Q; // undo 可能 stack みたいなのを作ればよさそう stack st, st2; for (ll q = 0; q < Q; q++) { ll t; cin >> t; if (t == 1) { char c; cin >> c; if (c == '(') { st.emplace(0); st2.emplace(-1); } if (c == '|') { if (!st.empty() && st.top() == 0) { st.pop(); st.emplace(1); st2.emplace(1); } else { st.emplace(-1); st2.emplace(-1); } } if (c == ')') { if (!st.empty() && st.top() == 1) { st.pop(); st2.emplace(2); } else { st.emplace(-1); st2.emplace(-1); } } } else { if (st2.top() == -1) st.pop(); else if (st2.top() == 2) st.emplace(1); else { st.pop(); st.emplace(0); } st2.pop(); } if ((ll)st.size() == 0) cout << "Yes" << endl; else cout << "No" << endl; } }