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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct BIT{
  ll bit[600001];

  void init(){
    memset(bit,0,sizeof(bit));
  }

  ll sum(int i){
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }

  void add(int i,ll v){
    while(i<=600000){
      bit[i]+=v;
      i+=i&-i;
    }
  }
};

ll n,cnt;
BIT bit;

int main(){
  scanf("%lld",&n);
  bit.init();
  rep(i,n){
    ll x;
    scanf("%lld",&x);
    if(x>=600000){
      cnt++;
      cout<<"Yes"<<endl;
    }else{
      if(bit.sum(1)==1||(bit.sum(x+1)==x&&(bit.sum(600000)-bit.sum(x+1)>0||cnt>0))){
        cout<<"No"<<endl;
      }else{
        cout<<"Yes"<<endl;
        ll crt=x+1;
        while(crt>0&&bit.sum(crt)-bit.sum(crt-1)==1){
          bit.add(crt,-1);
          crt--;
        }
        bit.add(crt,1);
      }
    }
  }
  return 0;
}


### Prompt

In Cpp, your task is to solve the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

struct BIT{
  ll bit[600001];

  void init(){
    memset(bit,0,sizeof(bit));
  }

  ll sum(int i){
    ll s=0;
    while(i>0){
      s+=bit[i];
      i-=i&-i;
    }
    return s;
  }

  void add(int i,ll v){
    while(i<=600000){
      bit[i]+=v;
      i+=i&-i;
    }
  }
};

ll n,cnt;
BIT bit;

int main(){
  scanf("%lld",&n);
  bit.init();
  rep(i,n){
    ll x;
    scanf("%lld",&x);
    if(x>=600000){
      cnt++;
      cout<<"Yes"<<endl;
    }else{
      if(bit.sum(1)==1||(bit.sum(x+1)==x&&(bit.sum(600000)-bit.sum(x+1)>0||cnt>0))){
        cout<<"No"<<endl;
      }else{
        cout<<"Yes"<<endl;
        ll crt=x+1;
        while(crt>0&&bit.sum(crt)-bit.sum(crt-1)==1){
          bit.add(crt,-1);
          crt--;
        }
        bit.add(crt,1);
      }
    }
  }
  return 0;
}


```