#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct BIT {
  vector<int> data;
  BIT(int n):data(n+1, 0){}
  int sum(int k) {
    int res = 0;
    while(k > 0) {
      res += data[k];
      k -= k & -k;
    }
    return res;
  }
  void add(int k, int x) {
    while(k < (int)data.size()) {
      data[k] += x;
      k += k & -k;
    }
  }
};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  BIT bit(n*2);
  bool deeper = false;
  rep(i, n) {
    int x;
    cin >> x;
    bool izryt = false;
    if(bit.sum(1) == 1) {
      izryt = false; //,cout<<1<<endl; // root medal ari
    } else if(x > n*2) {
      izryt = true, deeper = true; //,cout<<2<<endl;
    } else if(bit.sum(x+1) == x && (bit.sum(n*2)-bit.sum(x+1) > 0 || deeper)) { // root medal nasi [1,x] naname haichi
      izryt = false;//,cout<<3<<endl;;
    } else { // bit.sum(x+1) < x || hoge
      //cout<<4<<endl;
      izryt = true;
      int j = x;
      while(bit.sum(j+1)-bit.sum(j) > 0) bit.add(j+1, -1), j--;
      //cout<<j<<endl;
      bit.add(j+1, 1);
    }
    cout << (izryt ? "Yes" : "No") << endl;
  }

  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;

#define int long long
#define all(v) (v).begin(), (v).end()
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

struct BIT {
  vector<int> data;
  BIT(int n):data(n+1, 0){}
  int sum(int k) {
    int res = 0;
    while(k > 0) {
      res += data[k];
      k -= k & -k;
    }
    return res;
  }
  void add(int k, int x) {
    while(k < (int)data.size()) {
      data[k] += x;
      k += k & -k;
    }
  }
};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  BIT bit(n*2);
  bool deeper = false;
  rep(i, n) {
    int x;
    cin >> x;
    bool izryt = false;
    if(bit.sum(1) == 1) {
      izryt = false; //,cout<<1<<endl; // root medal ari
    } else if(x > n*2) {
      izryt = true, deeper = true; //,cout<<2<<endl;
    } else if(bit.sum(x+1) == x && (bit.sum(n*2)-bit.sum(x+1) > 0 || deeper)) { // root medal nasi [1,x] naname haichi
      izryt = false;//,cout<<3<<endl;;
    } else { // bit.sum(x+1) < x || hoge
      //cout<<4<<endl;
      izryt = true;
      int j = x;
      while(bit.sum(j+1)-bit.sum(j) > 0) bit.add(j+1, -1), j--;
      //cout<<j<<endl;
      bit.add(j+1, 1);
    }
    cout << (izryt ? "Yes" : "No") << endl;
  }

  return 0;
}
```