#include <bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define rep1(i,N) for(int i=1;i<=(int)N;i++)
#define pb push_back
#define all(c) c.begin(),c.end()
#define show(x) cout<<#x<<" "<<x<<endl
using namespace std;
bool d[500010];
int lim;
int N;
bool is1;
int popcnt;
bool canput(){
	int x;
	cin>>x;
	if(is1) return 0;
	if(x>N){
		popcnt++;
		return 1;
	}
	if(lim>x) return 0;
	if(lim==x){
		if(popcnt>lim) return 0;
		is1=1;
		return 1;
	}
	while(d[x]){
		d[x]=0;
		popcnt--;
		x--;
	}
	d[x]=1;
	popcnt++;
	while(d[lim+1]) lim++;
	return 1;
}
int main(){
	cin>>N;
	rep(i,N){
		if(canput()) puts("Yes");
		else puts("No");
	}
}
### 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>
#define rep(i,N) for(int i=0;i<(int)N;i++)
#define rep1(i,N) for(int i=1;i<=(int)N;i++)
#define pb push_back
#define all(c) c.begin(),c.end()
#define show(x) cout<<#x<<" "<<x<<endl
using namespace std;
bool d[500010];
int lim;
int N;
bool is1;
int popcnt;
bool canput(){
	int x;
	cin>>x;
	if(is1) return 0;
	if(x>N){
		popcnt++;
		return 1;
	}
	if(lim>x) return 0;
	if(lim==x){
		if(popcnt>lim) return 0;
		is1=1;
		return 1;
	}
	while(d[x]){
		d[x]=0;
		popcnt--;
		x--;
	}
	d[x]=1;
	popcnt++;
	while(d[lim+1]) lim++;
	return 1;
}
int main(){
	cin>>N;
	rep(i,N){
		if(canput()) puts("Yes");
		else puts("No");
	}
}
```