Problem:
Carpenters' Language
International Carpenters Professionals Company (ICPC) is a top construction company with a lot of expert carpenters.
What makes ICPC a top company is their original language.
The syntax of the language is simply given in CFG as follows:
S -> SS | (S) | )S( | ε
In other words, a right parenthesis can be closed by a left parenthesis and a left parenthesis can be closed by a right parenthesis in this language.
Alex, a grad student mastering linguistics, decided to study ICPC's language. 
As a first step of the study, he needs to judge whether a text is well-formed in the language or not.
Then, he asked you, a great programmer, to write a program for the judgement.
Alex's request is as follows: You have an empty string S in the beginning, and construct longer string by inserting a sequence of '(' or ')' into the string.
You will receive
q
queries, each of which consists of three elements
(p, c, n)
, where
p
is 
the position to insert,
n
is the number of characters to insert and
c
is either '(' or ')', the character to insert.
For each query, your program should insert
c
repeated by
n
times into the
p
-th position of S from the beginning.
Also it should output, after performing each insert operation, "Yes" if S is in the language and "No" if S is not in the language.
Please help Alex to support his study, otherwise he will fail to graduate the college.
Input
The first line contains one integer
q
(
1 \leq q \leq 10^5
) indicating the number of queries, follows
q
lines of three elements,
p_i
,
c_i
,
n_i
, separated by a single space (
1 \leq i \leq q
,
c_i = '(' or ')'
,
0 \leq p_i \leq
length of S before
i
-th query,
1 \leq n \leq 2^{20}
).
It is guaranteed that all the queries in the input are valid.
Output
For each query, output "Yes" if S is in the language and "No" if S is not in the language.
Sample Input 1
3
0 ( 10
10 ) 5
10 ) 5
Output for the Sample Input 1
No
No
Yes
Sample Input 2
3
0 ) 10
10 ( 5
10 ( 5
Output for the Sample Input 2
No
No
Yes
Sample Input 3
3
0 ( 10
10 ) 20
0 ( 10
Output for the Sample Input 3
No
No
Yes

Submitted solutions:

code_snippet: #include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define N 100000
#define ll long long
#define clr(xx,yy) memset(xx,yy,sizeof(xx))
ll a[N],b[N];
int main()
{
    long long  i,j,n,m,k,t,tt,max,maxn,p,T;
    char ch;
    while(scanf("%d",&T)!=EOF)
    {
        clr(a,0);
        for(i=1;i<=T;i++)
        {
           scanf("%lld %c %lld",&a[i],&ch,&n);
           for(j=1;j<i;j++)
           {
               if(a[j]==a[i]) {printf("Yes\n"); break;}
           }
           if(j>=i) printf("No\n");
        }

    }

    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3704
final_rank: 17

code_snippet: #include <bits/stdc++.h>

using namespace std;

int main(){
	int n; cin>>n;
	long long  ans = 0;
	for(int i=0; i<n; i++){
		char c;
		long long  a,b; cin>>a>>c>>b;
		if(c == ')') ans+= b;
		else ans -= b;
		if(ans != 0) cout<<"No"<<endl;
		else cout<<"Yes"<<endl;
	}
}
accuracy: 1
time_ms: 10
memory_kb: 3116
final_rank: 8

code_snippet: #include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
  int q;
  cin >> q;
  
  ll keep = 0;
  
  while (q--) {
    ll p, n;
    char c;
    cin >> p >> c >> n;
    
    if (c == '(') keep += n;
    else keep -= n;
    
    if (keep == 0) cout << "Yes\n";
    else cout << "No\n";
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3444
final_rank: 16

code_snippet: #include <bits/stdc++.h>

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;

//using namespace boost::multiprecision;
//#include<atcoder/all>
//using namespace atcoder;

using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

const ll mod = 998244353ll;
//const ll mod = 1000000007ll;
//const ll mod = 100000;


struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime modhttps://atcoder.jp/contests/abc166/submit?taskScreenName=abc166_f
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};

istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

#define rep(i, n)         for(ll i = 0; i < (ll)(n); i++)
//#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define bbrep(n)           for(int bbit=0;bbit<(1<<n);bbit++)
#define erep(i,container) for (auto &i : container)
#define itrep(i,container) for (auto i : container)
#define irep(i, n)        for(ll i = n-1; i >= (ll)0ll; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define repreprep(i,j,k,h,w,n) rep(i,h)rep(j,w)rep(k,n)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
//#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define kout(d) std::cout << keta(10)<< d<< std::endl;
#define vout(a) erep(qxqxqx,a)std::cout << qxqxqx << ' ';std::cout  << std::endl;
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
//#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<":"
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j);

#define RESRES(a,i,j,k) a.resize(i);rep(ii,i)a[ii].resize(j);reprep(ii,jj,i,j){a[ii][jj].resize(k);};
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define ppppri(a,b,c,d) std::cout << a<<" "<<b <<" "<< c<<' '<<d<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define SUM(a) accumulate(all(a),0ll) 
#define stirng string
#define gin(a,b) int a,b;std::cin >> a>>b;a--;b--;
#define popcount __builtin_popcount
#define permu(a) next_permutation(all(a))
#define aru(a,d) a.find(d)!=a.end()
#define nai(a,d) a.find(d)==a.end()
//#define aru p.find(mp(x,y))!=p.end()

//#define grid_input(a,type) int h,w;std::cin >> h>>w;vvector(a,type,h,w,0);reprep(i,j,h,w)std::cin >> a[i][j];

//typedef long long T;
ll ceili(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 2'000'000'000;
const ll INF64 =32233720854775807ll;
//const ll INF64 = 9223372036854775807ll;

//const ll INF64 = 243'000'000'000'000'000'0;Q


//const ll MOD = 100'000'000'7ll;
const ll MOD = 998244353ll;
//const ll MOD = 1000003ll;
const ll OD = 1000000000000007ll;
const dou pi=3.141592653589793;

long long modpow(long long a, long long n) { 
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}
//メモ
//ゲーム(Grundy数とか)の復習をする
//リスニング力をどうにかする
//個数制限付きナップサックの復習
//戻すDP
//全方位木DPとスライド最小値
//学会しゃべる練習をする
//llig 連続写真の三枚目を使ったほうがわかりやすいかも！
//自分の新規性の強調

int main(){
    ll l=0,r=0;
    query{
        ll p,n;
        char c;
        std::cin >> p>>c>>n;
        if(c=='(')l+=n;
        else r+=n;
        std::cout << (r==l?Yes:No) << std::endl;
        
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3184
final_rank: 11

code_snippet: #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF (1LL<<40)
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define MP make_pair
#define int long long
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define umap unordered_map 
#define re0 return 0
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
 int dx[]={0,1,0,-1};
 int dy[]={1,0,-1,0};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
bool is_kaibun(string s){string rs = s;reverse(all(rs));if(s == rs)return true;else return false;}


template<typename T> 
void printv(vector<T> v, bool is_endl=true){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    if(is_endl)cout<<endl;
}
//int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
// struct Point{
//     int x,y,num;

//     double e_dis(Point other){
//         return sqrt((x-other.x)*(x-other.x)+(y-other.y)*(y-other.y));
//     }
// };

int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

bool isPrime(int x){
  if(x==1)return 0;
  if(x==2)return 1;
  for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
  return 1;
}

//スプリット関数
//split(文字列変数,区切りたい文字);
vector<string> split(string s, char c){
    if(s[s.size()-1]!=c)s+=c;
    vector<string> v;
    int pos=0;
    rep(i,0,s.size()){
        if(s[i]==c){
            v.push_back(s.substr(pos,i-pos));
            pos=i+1;
        }
        if(i==s.size()-1 && s.substr(pos,i-pos)!="")v.push_back(s.substr(pos,i-pos));
    }
    return v;
}

typedef struct Data{
    int pos;
    int num;
}Data;

bool is_ok(vector<Data>& v){
    int ret = 0;
    rep(i,0,v.size()){
        ret += v[i].num;
    }
    return (ret==0);
}

vector<Data>& insert_v(vector<Data>& v, Data d){
    if(v.size()==0){
        v.push_back(d);
        return v;
    }
    int t;
    bool inserted = false;
    rep(i,0,v.size()){
        if(!inserted){
            if(t == d.pos){
                v.insert(v.begin()+i, d);
                inserted = true;
                i++;
            }
            t += v[i].pos;
        }else{
            v[i].pos += d.pos;
        }
    }
    if(!inserted){
        v.push_back(d);
    }
    return v;
}

void show(vector<Data>& v){
    rep(i,0,v.size()){
        cout<<"("<<(v[i].num<0?"( * ":") *")<<abs(v[i].num)<<") ";
    }
    cout<<endl;
}

signed main(){
    int q;
    cin>>q;
    vector<Data> v;
    rep(i,0,q){
        int p,n;
        char c;
        cin>>p>>c>>n;
        Data d;
        if(c=='(')d = Data{p, n};
        else d = Data{p, -n};
        v = insert_v(v, d);
        // show(v);
        if(is_ok(v))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    

}


/*
*/
accuracy: 1
time_ms: 60
memory_kb: 3288
final_rank: 18

code_snippet: #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF (1LL<<40)
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define MP make_pair
#define int long long
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define umap unordered_map 
#define re0 return 0
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
 int dx[]={0,1,0,-1};
 int dy[]={1,0,-1,0};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
bool is_kaibun(string s){string rs = s;reverse(all(rs));if(s == rs)return true;else return false;}


template<typename T> 
void printv(vector<T> v, bool is_endl=true){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    if(is_endl)cout<<endl;
}
//int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
// struct Point{
//     int x,y,num;

//     double e_dis(Point other){
//         return sqrt((x-other.x)*(x-other.x)+(y-other.y)*(y-other.y));
//     }
// };

int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

bool isPrime(int x){
  if(x==1)return 0;
  if(x==2)return 1;
  for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
  return 1;
}

//スプリット関数
//split(文字列変数,区切りたい文字);
vector<string> split(string s, char c){
    if(s[s.size()-1]!=c)s+=c;
    vector<string> v;
    int pos=0;
    rep(i,0,s.size()){
        if(s[i]==c){
            v.push_back(s.substr(pos,i-pos));
            pos=i+1;
        }
        if(i==s.size()-1 && s.substr(pos,i-pos)!="")v.push_back(s.substr(pos,i-pos));
    }
    return v;
}


signed main(){
    int q;
    cin>>q;
    int sum=0;
    int r=0,l=0;
    rep(i,0,q){
        int p,n;
        char c;
        cin>>p>>c>>n;
        
        if(c=='(')r += n;
        else l += n;
        if(r==l)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
        
        
    }
    

}


/*
*/
accuracy: 1
time_ms: 10
memory_kb: 3108
final_rank: 4

code_snippet: #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF (1LL<<40)
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define MP make_pair
// #define int long long
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define umap unordered_map 
#define re0 return 0
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
 int dx[]={0,1,0,-1};
 int dy[]={1,0,-1,0};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
bool is_kaibun(string s){string rs = s;reverse(all(rs));if(s == rs)return true;else return false;}


template<typename T> 
void printv(vector<T> v, bool is_endl=true){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    if(is_endl)cout<<endl;
}
//int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
// struct Point{
//     int x,y,num;

//     double e_dis(Point other){
//         return sqrt((x-other.x)*(x-other.x)+(y-other.y)*(y-other.y));
//     }
// };

int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

bool isPrime(int x){
  if(x==1)return 0;
  if(x==2)return 1;
  for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
  return 1;
}

//スプリット関数
//split(文字列変数,区切りたい文字);
vector<string> split(string s, char c){
    if(s[s.size()-1]!=c)s+=c;
    vector<string> v;
    int pos=0;
    rep(i,0,s.size()){
        if(s[i]==c){
            v.push_back(s.substr(pos,i-pos));
            pos=i+1;
        }
        if(i==s.size()-1 && s.substr(pos,i-pos)!="")v.push_back(s.substr(pos,i-pos));
    }
    return v;
}

typedef struct Data{
    int pos;
    int num;
}Data;

bool is_ok(vector<Data>& v){
    int ret = 0;
    rep(i,0,v.size()){
        ret += v[i].num;
    }
    return (ret==0);
}

vector<Data>& insert_v(vector<Data>& v, Data d){
    if(v.size()==0){
        v.push_back(d);
        return v;
    }
    int t;
    bool inserted = false;
    rep(i,0,v.size()){
        if(!inserted){
            if(t == d.pos){
                v.insert(v.begin()+i, d);
                inserted = true;
                i++;
            }
            t += v[i].pos;
        }else{
            v[i].pos += d.pos;
        }
    }
    if(!inserted){
        v.push_back(d);
    }
    return v;
}

void show(vector<Data>& v){
    rep(i,0,v.size()){
        cout<<"("<<(v[i].num<0?"( * ":") *")<<abs(v[i].num)<<") ";
    }
    cout<<endl;
}

int main(){
    int q;
    cin>>q;
    vector<Data> v;
    rep(i,0,q){
        int p,n;
        char c;
        cin>>p>>c>>n;
        Data d;
        if(c=='(')d = Data{p, n};
        else d = Data{p, -n};
        v = insert_v(v, d);
        // show(v);
        if(is_ok(v))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    

}


/*
*/
accuracy: 0.08108108108108109
time_ms: 50
memory_kb: 3148
final_rank: 20

code_snippet: #include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1e9
#define LINF (1LL<<40)
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define MP make_pair
// #define int long long
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define umap unordered_map 
#define re0 return 0
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
 int dx[]={0,1,0,-1};
 int dy[]={1,0,-1,0};
//typedef pair<int,int> P;

const long long MOD=1000000007LL;
bool isupper(char c){if('A'<=c&&c<='Z')return 1;return 0;}
bool islower(char c){if('a'<=c&&c<='z')return 1;return 0;}
bool isnumber(char c){return ('0'<=c&&c<='9');}
bool isalpha(char c){return (isupper(c)||islower(c));}
bool is_kaibun(string s){string rs = s;reverse(all(rs));if(s == rs)return true;else return false;}


template<typename T> 
void printv(vector<T> v, bool is_endl=true){
    for(int i=0;i<v.size();i++){
        if(i)cout<<" ";
        cout<<v[i];
    }
    if(is_endl)cout<<endl;
}
//int INF=1e18;

template<typename T>
void printendl(vector<T> v){
    for(auto date:v)cout<<date<<endl;
}

template<typename T>
void printvv(vector<vector<T>> v){
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v[i].size();j++){
            if(j)cout<<" ";
            cout<<v[i][j];
        }
        cout<<endl;
    }
}
// struct Point{
//     int x,y,num;

//     double e_dis(Point other){
//         return sqrt((x-other.x)*(x-other.x)+(y-other.y)*(y-other.y));
//     }
// };

int gcd(int a,int b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

bool isPrime(int x){
  if(x==1)return 0;
  if(x==2)return 1;
  for(int i=2;i*i<=x;i++)if(x%i==0)return 0;
  return 1;
}

//スプリット関数
//split(文字列変数,区切りたい文字);
vector<string> split(string s, char c){
    if(s[s.size()-1]!=c)s+=c;
    vector<string> v;
    int pos=0;
    rep(i,0,s.size()){
        if(s[i]==c){
            v.push_back(s.substr(pos,i-pos));
            pos=i+1;
        }
        if(i==s.size()-1 && s.substr(pos,i-pos)!="")v.push_back(s.substr(pos,i-pos));
    }
    return v;
}

typedef struct Data{
    int c;
    int n;
}Data;

bool is_ok(vector<Data>& v){
    int ret = 0;
    rep(i,0,v.size()){
        ret += v[i].n*v[i].c;
    }
    return (ret==0);
}

int main(){
    int q;
    cin>>q;
    vector<Data> v;
    rep(i,0,q){
        int p,n;
        char c;
        cin>>p>>c>>n;
        if(c=='(')v.push_back(Data{1, n});
        else v.push_back(Data{-1, n});
        if(is_ok(v))cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
    

}


/*
*/
accuracy: 0.08108108108108109
time_ms: 20
memory_kb: 3256
final_rank: 19

code_snippet: #include<bits/stdc++.h>
using namespace std;
#define N (1000000000+7)
//#define N 998244353
#define INF 1e18
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
const int inf = (int)1e9; 


int main(void){
  int q;
  cin>>q;
  ll l=0;
  ll r=0;
  for(int i=0;i<q;i++){
    ll p,n;
    char c;
    cin>>p>>c>>n;
    if(c=='(')l+=n;
    else r+=n;
    if(l==r){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
  }
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3436
final_rank: 14

code_snippet: #include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
    int q;
    cin >> q;
    ll balance = 0;
    for (int i = 0; i < q; i++) {
        ll p, n;
        string c;
        cin >> p >> c >> n;
        if (c == "(")
            balance += n;
        else
            balance -= n;
        if (balance == 0)
            cout << "Yes\n";
        else
            cout << "No\n";
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3440
final_rank: 15

code_snippet: #include <bits/stdc++.h>
using namespace std;

#define int long long
//typedef long long i64;

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<'\n'
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<'\n'
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<'\n'
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<'\n'
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<'\n'
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

#define MAX_N (1000)
#define INF (1LL << 60)
#define eps 1e-9
const int MOD = (int)1e9 + 7;


signed main(){
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);

    int q;
    cin >> q;
    int cnt[2] = {0,0};
    while(q--){
        int p,n;
        string c;
        cin >> p >> c >> n;
        if(c=="(") cnt[0]+=n;
        else cnt[1]+=n;
        if(cnt[0]==cnt[1]) cout << "Yes" << endl;
        else cout << "No" << endl;
    }

}

/*

概要：
クエリを実行したあと、その文字列Sが言語として正しいかどうかを判定する。
言語の例は、S -> SS -> SSSS -> (S)(S))S()S( -> ()())()(


考察：
同じ数の(と)があればOK?

*/
accuracy: 1
time_ms: 10
memory_kb: 3156
final_rank: 9

code_snippet: #include <iostream>
using namespace std;
typedef long long ll;

int main()
{
    int q;
    cin >> q;
    ll s = 0;
    while(q--){
        ll p;
        char c;
        ll n;
        cin >> p >> c >> n;
        if(c == '(') s += n;
        else s -= n;
        if(s) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3096
final_rank: 3

code_snippet: #include <bits/stdc++.h>
using namespace std;

// region template
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, x) for (auto &a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

ll gcd(ll a, ll b) { return __gcd(a, b); }

ll euclid(ll a, ll b, ll &x, ll &y) {
    if (b) { ll d = euclid(b, a % b, y, x);
        return y -= a/b * x, d; }
    return x = 1, y = 0, a;
}

typedef unsigned long long ull;
typedef long double ld;
ull mod_mul(ull a, ull b, ull M) {
    ll ret = a * b - M * ull(ld(a) * ld(b) / ld(M));
    return ret + M * (ret < 0) - M * (ret >= (ll)M);
}
ull mod_pow(ull b, ull e, ull mod) {
    ull ans = 1;
    for (; e; b = mod_mul(b, b, mod), e /= 2)
        if (e & 1) ans = mod_mul(ans, b, mod);
    return ans;
}

const ll mod = 1000000007;
struct Mod {
    ll x;
    Mod(ll xx) : x(xx) {}
    Mod operator+(Mod b) { return Mod((x + b.x) % mod); }
    Mod operator-(Mod b) { return Mod((x - b.x) % mod); }
    Mod operator*(Mod b) { return Mod((x * b.x) % mod); }
    Mod operator/(Mod b) { return *this * invert(b); }
    Mod invert(Mod a) {
        ll x, y, g = euclid(a.x, mod, x, y);
        assert(g == 1); return Mod((x + mod) % mod);
    }
    Mod operator^(ll e) {
        if (!e) return Mod(1);
        Mod r = *this ^ (e / 2); r = r * r;
        return e & 1 ? *this * r : r;
    }
};
// endregion

int main() {
    int q; cin >> q;
    ll ttl = 0;
    cin >> skipws;
    rep(i, 0, q) {
        int p, n; char c; cin >> p >> c >> n;
        if (c == '(') ttl -= n; else ttl += n;
        if (!ttl) cout << "Yes" << endl; else cout << "No" << endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3112
final_rank: 5

code_snippet: #include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll dp[11][156][22];
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/

	int kkt; scanf("%d", &kkt);
	string s;
	ll cnt0 = 0;
	ll cnt1 = 0;
	while (kkt--) {
		ll p, n;
		char c;
		cin >> p >> c >> n;
		if (c == '(') cnt0 += n;
		else cnt1 += n;
		if (cnt0 == cnt1) puts("Yes");
		else puts("No");
		/*
		string t;
		for (int i = 0; i < p; i++) t += s[i];
		t += string(n, c);
		for (int i = p; i < s.size(); i++) t += s[i];
		s = t;
		*/
	}
	return 0;

}
accuracy: 1
time_ms: 10
memory_kb: 3168
final_rank: 10

code_snippet: #include <bits/stdc++.h>
//typedef
//-------------------------#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
 
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
 
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 998244353
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const double EPS = 1E-8;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
 
class UnionFind {
public:
    vector <int> par; 
    vector <int> siz; 

    UnionFind(int sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
    void init(int sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i;
    }
 
    int root(int x) { 
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }
 
    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }
 
    bool issame(int x, int y) { 
        return root(x) == root(y);
    }
 
    int size(int x) { 
        return siz[root(x)];
    }
};
 
 
ll modPow(ll x, ll n, ll mod = MOD){
    ll res = 1;
    while(n){
        if(n&1) res = (res * x)%mod;
 
        res %= mod;
        x = x * x %mod;
        n >>= 1;
    }
    return res;
}
 
#define SIEVE_SIZE 5000000+10
bool sieve[SIEVE_SIZE];
void makeSieve(){
    for(int i=0; i<SIEVE_SIZE; ++i) sieve[i] = true;
    sieve[0] = sieve[1] = false;
    for(int i=2; i*i<SIEVE_SIZE; ++i) if(sieve[i]) for(int j=2; i*j<SIEVE_SIZE; ++j) sieve[i*j] = false;
}
 
bool isprime(ll n){
    if(n == 0 || n == 1) return false;
    for(ll i=2; i*i<=n; ++i) if(n%i==0) return false;
    return true;
}
 
const int MAX = 2000010;
long long fac[MAX], finv[MAX], inv[MAX];
 
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
long long extGCD(long long a, long long b, long long &x, long long &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a%b, y, x);
    y -= a/b * x;
    return d;
}
// 負の数にも対応した mod (a = -11 とかでも OK) 
inline long long mod(long long a, long long m) {
    return (a % m + m) % m;
}
 
// 逆元計算 (ここでは a と m が互いに素であることが必要)
long long modinv(long long a, long long m) {
    long long x, y;
    extGCD(a, m, x, y);
    return mod(x, m); // 気持ち的には x % m だが、x が負かもしれないので
}
ll GCD(ll a, ll b){
    
    if(b == 0) return a;
    return GCD(b, a%b);
}

typedef vector<ll> vec;
typedef vector<vec> mat;

mat mul(mat &A, mat &B) {
    mat C(A.size(), vec((int)B[0].size()));
    for(int i=0; i<A.size(); ++i){
        for(int k=0; k<B.size(); ++k){
            for(int j=0; j<B[0].size(); ++j){
                C[i][j] = (C[i][j] + A[i][k] * B[k][j] %MOD) % MOD;
            }
        }
    }
    return C;
}
mat matPow(mat A, ll n) {
    mat B(A.size(), vec((int)A.size()));
 
    for(int i=0; i<A.size(); ++i){
        B[i][i] = 1;
    }
 
    while(n > 0) {
        if(n & 1) B = mul(B, A);
        A = mul(A, A);
        n >>= 1;
    }
    return B;
}

int ans[200010];
bool used[200010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);

    int q; cin >> q;
    ll suml = 0, sumr =0;
    while(q--){
        ll p, n;
        char c; cin >> p >> c >> n;

        if(c == '(') suml += n;
        else sumr += n;

        if(suml == sumr){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3212
final_rank: 12

code_snippet: #include <bits/stdc++.h>
using namespace std;

using ll = long long int;

int solve(){
    ll q, cnt = 0;
    cin >> q;
    for(int i=0;i<q;i++){
        ll p, n;
        char c;
        cin >> p >> c >> n;
        if(c == '(') cnt += n;
        else cnt -= n;
        cout << (cnt==0 ? "Yes" : "No") << endl;
    }
    return 0;
}

int main(){
    solve();
    return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3112
final_rank: 5

code_snippet: #define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(20);
}

#define int ll

void solve() {
	int n;
	cin >> n;
	int cnt = 0;
	REP(i, n) {
		int a, b;
		char c;
		cin >> a >> c >> b;
		if (c == '(') {
			cnt += b;
		}
		else {
			cnt -= b;
		}
		if (cnt == 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
}

#undef int
int main() {
	init();
	solve();
}
accuracy: 1
time_ms: 10
memory_kb: 3216
final_rank: 13

code_snippet: #include <iostream>

using namespace std;

int main() {
	int q, p, n; cin >> q;
	char c;
	long long cnt[2] = {};
	while (q--) {
		cin >> p >> c >> n;
		cnt[c - '('] += n;
		if (cnt[0] == cnt[1]) cout << "Yes" << endl;
		else cout << "No" << endl;
	}

	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3084
final_rank: 1

code_snippet: #include <bits/stdc++.h>
using namespace std;

int main(){
	int q;
	cin >> q;
	int p,n;
	char c;
	long long st=0;
	for(int i=0;i<q;i++){
		cin >> p >> c >> n;
		if(c=='(') st+=n;
		else st-=n;
		if(st) cout <<"No"<< endl;
		else cout <<"Yes"<< endl;
	}
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3092
final_rank: 2

code_snippet: #include <bits/stdc++.h>
using namespace std;

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

int main(void) {
  int64 n;
  int64 l = 0, r = 0;
  cin >> n;
  REP(i, n) {
    int64 a, b;
    char c;
    cin >> a >> c >> b;
    if (c == '(') l+=b;
    else r += b;
    if (l == r) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
}
accuracy: 1
time_ms: 10
memory_kb: 3112
final_rank: 5