#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a ,b) for(int i = int(a); i < int(b); ++i)
#define REP(i, a) FOR(i, 0, a)
#define RFOR(i, a, b) for(int i = int(b)-1; i >= int(a); --i)
#define RREP(i,a) RFOR(i, 0, a)
#define IN(a, x , b) (a <= x && x <= b)
template<class T> inline void CHMIN(T& a, T& b){if(a<b)a=b;}
template<class T> inline void CHMAX(T& a, T& b){if(a>b)a=b;}

using ll = long long;

template<class T> using V = std::vector<T>;
using namespace std;

int main(){
  int n;
  cin >> n;
  V<int> x(n);
  REP(i, n) cin >> x[i];
  set<int> st;
  int p = 1;
  bool ng = false;
  REP(_, n) {
    if(ng) {
      cout << "No" << '\n';
      continue;
    }
    int t = x[_];
    if(t < p - 1) {
      cout << "No" << '\n';
    }
    else if(t == p - 1) {
      auto it = st.upper_bound(t);
      if(it == st.end()) {
        cout << "Yes" << '\n';
        ng = true;
      }else {
        cout << "No" << '\n';
      }
    }
    else {
      cout << "Yes" << '\n';
    }
    while(st.count(t)) {
      st.erase(t);
      --t;
    }
    st.insert(t);
    while(st.count(p)) ++p;
  }
  return 0;
}


### Prompt

Please provide a cpp coded solution to the problem described below:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>

#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a ,b) for(int i = int(a); i < int(b); ++i)
#define REP(i, a) FOR(i, 0, a)
#define RFOR(i, a, b) for(int i = int(b)-1; i >= int(a); --i)
#define RREP(i,a) RFOR(i, 0, a)
#define IN(a, x , b) (a <= x && x <= b)
template<class T> inline void CHMIN(T& a, T& b){if(a<b)a=b;}
template<class T> inline void CHMAX(T& a, T& b){if(a>b)a=b;}

using ll = long long;

template<class T> using V = std::vector<T>;
using namespace std;

int main(){
  int n;
  cin >> n;
  V<int> x(n);
  REP(i, n) cin >> x[i];
  set<int> st;
  int p = 1;
  bool ng = false;
  REP(_, n) {
    if(ng) {
      cout << "No" << '\n';
      continue;
    }
    int t = x[_];
    if(t < p - 1) {
      cout << "No" << '\n';
    }
    else if(t == p - 1) {
      auto it = st.upper_bound(t);
      if(it == st.end()) {
        cout << "Yes" << '\n';
        ng = true;
      }else {
        cout << "No" << '\n';
      }
    }
    else {
      cout << "Yes" << '\n';
    }
    while(st.count(t)) {
      st.erase(t);
      --t;
    }
    st.insert(t);
    while(st.count(p)) ++p;
  }
  return 0;
}


```