#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);
const int MAX = 510000;

//変数
LL n;
vector<LL> x;
vector<bool> exist;
bool bigThere = false;





//サブ関数
//入力
void input()
{
	cin >> n;
	exist.resize(MAX);
}

//枝刈
int failNo() {
	static int id = 0;
	while (exist[id + 1])id++;
	return id;
}

bool isSafeFail(int now) {
	if (bigThere)return false;


	FOR(i, now + 1, MAX) {
		if (exist[i])
			return false;
	}
	return true;
}

void insert(vector<bool>& exist, LL now) {
	if (exist[now]) {
		exist[now] = false;
		insert(exist, now - 1);
	}
	else {
		exist[now] = true;
	}
}

//計算
void calc()
{
	REP(i,n){
		LL now;
		cin >> now;
		if (n < now)bigThere = true;

		if (exist[0] || (now <= failNo() && !isSafeFail(now))) {
			if (n < now)bigThere = true;
			cout << "No" << endl;
		}
		else {
			if (now <= n) {
				insert(exist, now);
			}
			cout << "Yes" << endl;
		}
	}
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	//output();
	//debug();
	
	return 0;
}


### Prompt

Your task is to create 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<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);
const int MAX = 510000;

//変数
LL n;
vector<LL> x;
vector<bool> exist;
bool bigThere = false;





//サブ関数
//入力
void input()
{
	cin >> n;
	exist.resize(MAX);
}

//枝刈
int failNo() {
	static int id = 0;
	while (exist[id + 1])id++;
	return id;
}

bool isSafeFail(int now) {
	if (bigThere)return false;


	FOR(i, now + 1, MAX) {
		if (exist[i])
			return false;
	}
	return true;
}

void insert(vector<bool>& exist, LL now) {
	if (exist[now]) {
		exist[now] = false;
		insert(exist, now - 1);
	}
	else {
		exist[now] = true;
	}
}

//計算
void calc()
{
	REP(i,n){
		LL now;
		cin >> now;
		if (n < now)bigThere = true;

		if (exist[0] || (now <= failNo() && !isSafeFail(now))) {
			if (n < now)bigThere = true;
			cout << "No" << endl;
		}
		else {
			if (now <= n) {
				insert(exist, now);
			}
			cout << "Yes" << endl;
		}
	}
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	//output();
	//debug();
	
	return 0;
}


```