#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define up(i,j,n)	for(int i=j;i<=n;i++)
#define down(i,j,n)	for(int i=j;i>=n;i--)
#define cmax(a,b)	a=max(a,b)
#define cmin(a,b)	a=min(a,b)
#define bin(i)		(1<<i)

const int MAXN=5e5+5;
const int oo=0x3f3f3f3f;
const int LIM=5e5;

int N,fullpre=0,suf=0;
map<int,int>d;

namespace solution{
	void Solve(){
		scanf("%d",&N);
		while(N--){
			int o;
			scanf("%d",&o);
			if(d[0]==1){
				puts("No");
				continue;
			}
			if(!d[o]){
				d[o]++;
				cmax(suf,o);
				puts("Yes");
			}else{
				if(o<=fullpre&&suf>o)puts("No");
				else{
					d[o]++;
					while(d[o]>1){
						d[o]%=2;
						if(o==suf)suf--;
						d[--o]++;
					}
					puts("Yes");
				}
			}
			while(d[fullpre+1]==1)fullpre++;
			while(fullpre-1>=1&&d[fullpre]==0)fullpre--;
		}
	}
}

int main(){
//	freopen("input.in","r",stdin);
	using namespace solution;
	Solve();
	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 ll long long
#define up(i,j,n)	for(int i=j;i<=n;i++)
#define down(i,j,n)	for(int i=j;i>=n;i--)
#define cmax(a,b)	a=max(a,b)
#define cmin(a,b)	a=min(a,b)
#define bin(i)		(1<<i)

const int MAXN=5e5+5;
const int oo=0x3f3f3f3f;
const int LIM=5e5;

int N,fullpre=0,suf=0;
map<int,int>d;

namespace solution{
	void Solve(){
		scanf("%d",&N);
		while(N--){
			int o;
			scanf("%d",&o);
			if(d[0]==1){
				puts("No");
				continue;
			}
			if(!d[o]){
				d[o]++;
				cmax(suf,o);
				puts("Yes");
			}else{
				if(o<=fullpre&&suf>o)puts("No");
				else{
					d[o]++;
					while(d[o]>1){
						d[o]%=2;
						if(o==suf)suf--;
						d[--o]++;
					}
					puts("Yes");
				}
			}
			while(d[fullpre+1]==1)fullpre++;
			while(fullpre-1>=1&&d[fullpre]==0)fullpre--;
		}
	}
}

int main(){
//	freopen("input.in","r",stdin);
	using namespace solution;
	Solve();
	return 0;
}
```