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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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;}

int N;

signed main(){
    cin>>N;

    set<pint>s;
    s.insert({0,0});

    rep(i,N){
        int x;cin>>x;
        auto it=s.lower_bound({x+1,-1});
        if(it==s.begin()){
            cout<<"No"<<endl;
            continue;
        }
        it--;
        pint p=*it;
        s.erase(it);

        if(p.se<x){
            if(p.fi!=p.se)s.insert({p.fi,p.se-1});
            s.insert({p.se+1,x});
        }
        else{
            if(p.fi!=x)s.insert({p.fi,x-1});
            if(p.se!=x)s.insert({x+1,p.se});
        }
        cout<<"Yes"<<endl;
    }

    return 0;
}
### Prompt

Generate a CPP solution to 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 rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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;}

int N;

signed main(){
    cin>>N;

    set<pint>s;
    s.insert({0,0});

    rep(i,N){
        int x;cin>>x;
        auto it=s.lower_bound({x+1,-1});
        if(it==s.begin()){
            cout<<"No"<<endl;
            continue;
        }
        it--;
        pint p=*it;
        s.erase(it);

        if(p.se<x){
            if(p.fi!=p.se)s.insert({p.fi,p.se-1});
            s.insert({p.se+1,x});
        }
        else{
            if(p.fi!=x)s.insert({p.fi,x-1});
            if(p.se!=x)s.insert({x+1,p.se});
        }
        cout<<"Yes"<<endl;
    }

    return 0;
}
```