#include <iostream>
#include <vector>

void Can_Build(int* list)
{
	int amount;
	bool sqr = 0, rect_1 = 0, rect_2 = 0;
	for(int i = 0; i < 10001; i++)
	{
		amount = list[i];

		if (amount == 0) continue;

		if(!sqr && amount >= 4)
		{
			amount -= 4;
			sqr = 1;
		}

		if (amount == 0) continue;

		if(!rect_1 && amount >= 2)
		{
			amount -= 2;
			rect_1 = 1;
		}

		if (amount == 0) continue;

		if(rect_1 &&  amount >= 2)
		{
			rect_2 = 1;
		}

		if(sqr && rect_1 && rect_2)
		{
			std::cout << "YES\n";
			return;
		}
	}

	std::cout << "NO\n";
}

int main()
{
	int t,value;
	char ch;
	std::cin >> t;
	int list[10001] = { 0 };
	for(int i = 0; i<t; i++)
	{
		std::cin >> value;
		list[value]++;

	}
	std::cin >> t;
	for(int i = 0; i<t; i++)
	{
		std::cin >> ch >> value;
		if(ch == '+')
		{
			list[value]++;
		}

		else if(ch == '-')
		{
			list[value]--;
		}

		Can_Build(list);
	}
}


#include <iostream>
#include <vector>

class Planck_List
{
public:
	int m_size;
	int m_amount;

	Planck_List(int size)
	: m_size(size), m_amount(1) {}
};

void Put_Planck(std::vector<Planck_List>& list, int value)
{
	for(int i = 0; i < list.size(); i++)
	{
		if (list[i].m_size == value)
		{
			list[i].m_amount++;
			return;
		}
	}

	list.emplace_back(Planck_List(value));

}

void Remove_Planck(std::vector<Planck_List>& list, int value)
{
	for (int i = 0; i < list.size(); i++)
	{
		if (list[i].m_size == value)
		{
			list[i].m_amount--;
			return;
		}
	}
}

void Can_Build(std::vector<Planck_List> &list)
{
	bool square = 0, rectangle_x = 0, rectangle_y = 0;
	int amount;
	for(int i = 0; i < list.size(); i++)
	{
		amount = list[i].m_amount;
		if (!square && amount >= 4)
		{
			square = 1;
			amount -= 4;
		}

		if(!rectangle_x && amount >= 2)
		{
			rectangle_x = 1;
			amount -= 2;
		}

		if(rectangle_x && !rectangle_y && amount >= 2)
		{
			rectangle_y = 1;
			amount -= 2;
		}

		if (square && rectangle_x && rectangle_y)
		{
			std::cout << "YES\n";
			return;
		}
	}

	std::cout << "NO\n";
}

int main()
{
	int t,value;
	char ch;
	std::cin >> t;
	std::vector<Planck_List> list;
	for(int i = 0; i<t; i++)
	{
		std::cin >> value;
		Put_Planck(list, value);
	}
	std::cin >> t;
	for(int i = 0; i<t; i++)
	{
		std::cin >> ch >> value;
		if(ch == '+')
		{
			Put_Planck(list, value);
		}
		else if(ch == '-')
		{
			Remove_Planck(list, value);
		}

		Can_Build(list);
	}
}


#include <iostream>
#include <vector>

class Planck_List
{
public:
	int m_size;
	int m_amount;

	Planck_List(int size)
	: m_size(size), m_amount(1) {}
};

void Put_Planck(std::vector<Planck_List>& list, int value, int &size)
{
	for(int i = 0; i < size; i++)
	{
		if (list[i].m_size == value)
		{
			list[i].m_amount++;
			return;
		}
	}
	size++;
	list.emplace_back(Planck_List(value));

}

void Remove_Planck(std::vector<Planck_List>& list, int value, int size)
{
	for (int i = 0; i < size; i++)
	{
		if (list[i].m_size == value)
		{
			list[i].m_amount--;
			return;
		}
	}
}

void Can_Build(std::vector<Planck_List> &list, int size)
{
	bool square = 0, rectangle_x = 0, rectangle_y = 0;
	int amount;
	for(int i = 0; i < size; i++)
	{
		amount = list[i].m_amount;
		if (!square && amount >= 4)
		{
			square = 1;
			amount -= 4;
		}

		if(!rectangle_x && amount >= 2)
		{
			rectangle_x = 1;
			amount -= 2;
		}

		if(rectangle_x && !rectangle_y && amount >= 2)
		{
			rectangle_y = 1;
			amount -= 2;
		}

		if (square && rectangle_x && rectangle_y)
		{
			std::cout << "YES\n";
			return;
		}
	}

	std::cout << "NO\n";
}

int main()
{
	int t,value,size = 0;
	char ch;
	std::cin >> t;
	std::vector<Planck_List> list;
	for(int i = 0; i<t; i++)
	{
		std::cin >> value;
		Put_Planck(list, value, size);
	}
	std::cin >> t;
	for(int i = 0; i<t; i++)
	{
		std::cin >> ch >> value;
		if(ch == '+')
		{
			Put_Planck(list, value, size);
		}
		else if(ch == '-')
		{
			Remove_Planck(list, value, size);
		}

		Can_Build(list, size);
	}
}


#include <iostream>
#include <vector>

void Can_Build(int* list)
{
	int amount;
	bool sqr = 0, rect_1 = 0, rect_2 = 0;
	for(int i = 0; i < 10001; i++)
	{
		amount = list[i];

		if (amount == 0) continue;

		if(!sqr && amount >= 4)
		{
			amount -= 4;
			sqr = 1;
		}

		if (amount == 0) continue;

		if(!rect_1 && amount >= 2)
		{
			amount -= 2;
			rect_1 = 1;
		}

		if (amount == 0) continue;

		if(rect_1 &&!rect_2 && amount >= 2)
		{
			amount -= 2;
			rect_2 = 1;
		}

		if(sqr && rect_1 && rect_2)
		{
			std::cout << "YES\n";
			return;
		}
	}

	std::cout << "NO\n";
}

int main()
{
	int t,value;
	char ch;
	std::cin >> t;
	int list[10001] = { 0 };
	for(int i = 0; i<t; i++)
	{
		std::cin >> value;
		list[value]++;

	}
	std::cin >> t;
	for(int i = 0; i<t; i++)
	{
		std::cin >> ch >> value;
		if(ch == '+')
		{
			list[value]++;
		}

		else if(ch == '-')
		{
			list[value]--;
		}

		Can_Build(list);
	}
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	scd(n);
	rep(i,1,n){
		scd(temp);
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	scd(m);
	char op;
	rep(i,1,m){
		getchar();
		scc(op);scd(temp);
		if(op=='+'){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			cnt1+=temp/4;
			temp%=4;
			cnt2+=temp/2;
		}
		if(cnt1>=2){
			cout<<"YES"<<endl;
		}
		else if(cnt1>=1&&cnt2>=2){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	cin>>n;
	rep(i,1,n){
		cin>>temp;
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	cin>>m;
	string op;
	rep(i,1,m){
		cin>>op>>temp;
		//��������Ϣ���д���
		if(op=="+"){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
				if(!p[temp])
					p.erase(temp);   //��ʱɾ����
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		bool flag=false;
		map<int,int>::iterator iter; //����ָ�롣
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp>>2;//��ȡ������Ϊ׼��
				temp%=4;
			}
			if(temp>=2){      //��ȡ���Ρ�
				cnt2+=temp>>1;
			}
			if((cnt1>=1&&cnt2>=2)||cnt1>=2){     //������ж��Ƿ�����������ʱ�˳����ɻ��ǳ�ʱ��
				cout<<"YES"<<endl;
				flag=true;
				break;
			}
		}
		if(!flag)
			cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	map<int,int>::iterator iter;//������������
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	scd(n);
	rep(i,1,n){
		scd(temp);
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	scd(m);
	char op;
	rep(i,1,m){
		getchar();
		scc(op);scd(temp);
		if(op=='+'){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
				if(!p[temp])
					p.erase(temp);//һ��Ҫɾ����
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0,flag=1;//ͳ���ĸ���������ľ����Ŀ��
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp/4;
				temp%=4;
			}
			if(temp>=2)cnt2+=temp/2;
			if(cnt1>=2||(cnt1>=1&&cnt2>=2)){
				cout<<"YES"<<endl;
				flag=0;
				break;
			}
		}
		if(flag)cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	while(1){
		solve();
	}
	return 0;
}


/*
*邮箱：2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*注：代码如有问题请私信我或在评论区留言，谢谢支持。
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//低版本G++编译器不支持，若使用这种G++编译器此段应注释掉
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//i为循环变量，a为初始值，n为界限值，递增
#define per(i,a,n) for (int i=a;i>=n;i--)//i为循环变量， a为初始值，n为界限值，递减。
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//无穷大
const int maxn = 1e5+1;//最大值。
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************分割线，以上为代码自定义代码模板***************************************//

void solve(){
    int cnt2=0,cnt4=0;
    map<int,int> p;
    int n,m,temp;//n个木板，m个操作，temp临时变量。
    cin>>n;
    rep(i,1,n){
        cin>>temp;
        p[temp]++;
        //每满足2或4，对应的统计数目就加1，这样不会造成重复的记录。
        if(p[temp]%2==0)cnt2++;
        if(p[temp]%4==0)cnt4++;
    }
    cin>>m;
    string op;
    rep(i,1,m){
        cin>>op>>temp;
        if(op=="+"){
            p[temp]++;
            //这要先加再统计。
            if(p[temp]%2==0)cnt2++;
            if(p[temp]%4==0)cnt4++;
        }
        else{
            //这要先统计再减，这与模运算的性质有关。
            if(p[temp]%2==0)cnt2--;
            if(p[temp]%4==0)cnt4--;
            p[temp]--;
        }
        if(cnt4>=1&&cnt2>=4){
            //如果满足最低条件。
            cout<<"YES"<<endl;
        }
        else
            cout<<"NO"<<endl;
    }
}
int main(){
	//freopen("in.txt", "r", stdin);//提交的时候要注释掉
	ios::sync_with_stdio(false);//打消iostream中输入输出缓存，节省时间。
	cin.tie(0); cout.tie(0);//可以通过tie(0)（0表示NULL）来解除cin与cout的绑定，进一步加快执行效率。
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	scd(n);
	rep(i,1,n){
		scd(temp);
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	scd(m);
	char op;
	rep(i,1,m){
		getchar();
		scc(op);scd(temp);
		if(op=='+'){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
				if(!p[temp])
					p.erase(temp);//һ��Ҫɾ����
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0,flag=1;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp/4;
				temp%=4;
			}
			if(temp>=2)cnt2+=temp/2;
			if(cnt1>=2||(cnt1>=1&&cnt2>=2)){
				cout<<"YES"<<endl;
				flag=0;
				break;
			}
		}
		if(flag)cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	while(1){
		solve();
	}
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	cin>>n;
	rep(i,1,n){
		cin>>temp;
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	cin>>m;
	string op;
	rep(i,1,n){
		cin>>op>>temp;
		if(op=="+"){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			cnt1+=temp/4;
			temp%=4;
			cnt2+=temp/2;
		}
		if(cnt1>=1&&cnt2>=2){
			cout<<"YES"<<endl;
		}
		else if(cnt1>=2){
			cout<<"YES"<<endl;
		}
		else
			cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	cin>>n;
	rep(i,1,n){
		cin>>temp;
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	cin>>m;
	string op;
	rep(i,1,m){
		cin>>op>>temp;
		if(op=="+"){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		bool flag=false;
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp>>2;
				temp%=4;
			}
			if(temp>=2){
				cnt2+=temp>>1;
			}
			if((cnt1>=1&&cnt2>=2)||cnt1>=2){
				cout<<"YES"<<endl;
				flag=true;
				break;
			}
		}
		if(!flag)
			cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	scd(n);
	rep(i,1,n){
		scd(temp);
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	scd(m);
	char op;
	rep(i,1,m){
		getchar();
		scc(op);scd(temp);
		if(op=='+'){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp/4;
				temp%=4;
			}
			if(temp>=2)cnt2+=temp/2;
		}
		if(cnt1>=2||(cnt1>=1&&cnt2>=2)){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


/*邮箱：2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*注：代码如有问题请私信我或在评论区留言，谢谢支持。
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//低版本G++编译器不支持，若使用这种G++编译器此段应注释掉
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//i为循环变量，a为初始值，n为界限值，递增
#define per(i,a,n) for (int i=a;i>=n;i--)//i为循环变量， a为初始值，n为界限值，递减。
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//无穷大
const int maxn = 1e5+1;//最大值。
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************分割线，以上为代码自定义代码模板***************************************//

void solve(){
    multiset<int,greater<int> > s;//排列规则从大到小。
    int cnt[maxn]={0};//cnt统计每个木块出现的次数。
    int n,m,temp;
    cin>>n;
    rep(i,0,n-1){
        cin>>temp;
        cnt[temp]++;//统计完之后再插入。
    }
    rep(i,1,100000){
        //这里一定要注意是遍历1到100000
        s.insert(cnt[i]);//把数据放入multiset容器中。
    }
    cin>>m;
    string op;
    int a;
    rep(i,1,m){
        cin>>op>>a;
        s.erase(s.find(cnt[a]));//先删除，之后再插入，由于插入和删除一个数都能在logn时间内完成我们自然不必担心。
        if(op=="+"){
            cnt[a]++;
        }
        else{
            cnt[a]--;
        }
        s.insert(cnt[a]);//再插入。
        multiset<int,greater<int> >::iterator iter=s.begin();//获得反转初始迭代器
        int m1=*iter;
        iter++;
        int m2=*iter;
        iter++;
        int m3=*iter;
        //这个步骤是取木块长度相同数目最多的前三位，我们只要判断这三个即可。
        if(m1>=8||(m1>=6&&m2>=2)||(m1>=4&&m2>=4)||(m1>=4&&m2>=2&&m3>=2))
        	//判断组成正方形和矩形的必备条件。即对正方形来说一定要四条相同的边，对于长方形来说至少要两种两条相同的边。
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
}
int main(){
	//freopen("in.txt", "r", stdin);//提交的时候要注释掉
	ios::sync_with_stdio(false);//打消iostream中输入输出缓存，节省时间。
	cin.tie(0); cout.tie(0);//可以通过tie(0)（0表示NULL）来解除cin与cout的绑定，进一步加快执行效率。
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	scd(n);
	rep(i,1,n){
		scd(temp);
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	scd(m);
	char op;
	rep(i,1,m){
		getchar();
		scc(op);scd(temp);
		if(op=='+'){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0,flag=1;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			if(temp>=4){
				cnt1+=temp/4;
				temp%=4;
			}
			if(temp>=2)cnt2+=temp/2;
			if(cnt1>=2||(cnt1>=1&&cnt2>=2)){
				cout<<"YES"<<endl;
				flag=0;
				break;
			}
		}
		if(flag)cout<<"NO"<<endl;
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	while(1){
		solve();
	}
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	cin>>n;
	rep(i,1,n){
		cin>>temp;
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	cin>>m;
	string op;
	rep(i,1,n){
		cin>>op>>temp;
		if(op=="+"){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			cnt1+=temp/4;
			temp%=4;
			cnt2+=temp/2;
		}
		if(cnt1>=2){
			cout<<"YES"<<endl;
		}
		else if(cnt1>=1&&cnt2>=2){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


*邮箱：2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*注：代码如有问题请私信我或在评论区留言，谢谢支持。
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//低版本G++编译器不支持，若使用这种G++编译器此段应注释掉
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//i为循环变量，a为初始值，n为界限值，递增
#define per(i,a,n) for (int i=a;i>=n;i--)//i为循环变量， a为初始值，n为界限值，递减。
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//无穷大
const int maxn = 1e5+1;//最大值。
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************分割线，以上为代码自定义代码模板***************************************//

void solve(){
    multiset<int,greater<int> > s;//排列规则从大到小。
    int cnt[maxn]={0};//cnt统计每个木块出现的次数。
    int n,m,temp;
    cin>>n;
    rep(i,0,n-1){
        cin>>temp;
        cnt[temp]++;//统计完之后再插入。
    }
    rep(i,1,100000){
        //这里一定要注意是遍历1到100000
        s.insert(cnt[i]);//把数据放入multiset容器中。
    }
    cin>>m;
    string op;
    int a;
    rep(i,1,m){
        cin>>op>>a;
        s.erase(s.find(cnt[a]));//先删除，之后再插入，由于插入和删除一个数都能在logn时间内完成我们自然不必担心。
        if(op=="+"){
            cnt[a]++;
        }
        else{
            cnt[a]--;
        }
        s.insert(cnt[a]);//再插入。
        multiset<int,greater<int> >::iterator iter=s.begin();//获得反转初始迭代器
        int m1=*iter;
        iter++;
        int m2=*iter;
        iter++;
        int m3=*iter;
        //这个步骤是取木块长度相同数目最多的前三位，我们只要判断这三个即可。
        if(m1>=8||(m1>=6&&m2>=2)||(m1>=4&&m2>=4)||(m1>=4&&m2>=2&&m3>=2))
        	//判断组成正方形和矩形的必备条件。即对正方形来说一定要四条相同的边，对于长方形来说至少要两种两条相同的边。
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
}
int main(){
	//freopen("in.txt", "r", stdin);//提交的时候要注释掉
	ios::sync_with_stdio(false);//打消iostream中输入输出缓存，节省时间。
	cin.tie(0); cout.tie(0);//可以通过tie(0)（0表示NULL）来解除cin与cout的绑定，进一步加快执行效率。
	solve();
	return 0;
}


/*
*���䣺2825841950@qq.com
*blog:https://blog.csdn.net/hzf0701
*ע����������������˽���һ������������ԣ�лл֧�֡�
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<cstring>
#include<map>
#include<iterator>
#include<list>
#include<set>
#include<functional>
#include<memory.h>//�Ͱ汾G++��������֧�֣���ʹ������G++�������˶�Ӧע�͵�
#include<iomanip>
#include<vector>
#include<cstring>
#define scd(n) scanf("%d",&n)
#define scf(n) scanf("%f",&n)
#define scc(n) scanf("%c",&n)
#define scs(n) scanf("%s",n)
#define prd(n) printf("%d",n)
#define prf(n) printf("%f",n)
#define prc(n) printf("%c",n)
#define prs(n) printf("%s",n)
#define rep(i,a,n) for (int i=a;i<=n;i++)//iΪѭ��������aΪ��ʼֵ��nΪ����ֵ������
#define per(i,a,n) for (int i=a;i>=n;i--)//iΪѭ�������� aΪ��ʼֵ��nΪ����ֵ���ݼ���
#define pb push_back
#define fi first
#define se second
#define mp make_pair
using namespace std;
const int inf = 0x3f3f3f3f;//�����
const int maxn = 1e5;//���ֵ��
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll>  pll;
typedef pair<int, int> pii;
//*******************************�ָ��ߣ�����Ϊ�����Զ������ģ��***************************************//

void solve(){
	map<int,int> p;
	int n,m,temp;//nΪ�ֿ�ԭ��ľ��������mΪ����Ҫ���еĲ�����tempΪ��ʱ������
	cin>>n;
	rep(i,1,n){
		cin>>temp;
		p[temp]++;//ͳ�Ƴ��ֵĴ�����

	}
	cin>>m;
	string op;
	rep(i,1,m){
		cin>>op>>temp;
		if(op=="+"){
			p[temp]++;
		}
		else{
			if(p[temp]){
				p[temp]--;//�ж��Ƿ��С�
			}
		}
		//�������������ж���û��һ��ľ���ǳ����Ĵεģ�����ľ���ǳ������εģ�����ͳ�Ƽ��ɣ�
		int cnt1=0,cnt2=0;//ͳ���ĸ���������ľ����Ŀ��
		map<int,int>::iterator iter;
		for(iter=p.begin();iter!=p.end();iter++){
			temp=iter->se;//��ȡ��ľ���������
			cnt1+=temp/4;
			temp%=4;
			cnt2+=temp/2;
		}
		if(cnt1>=2){
			cout<<"YES"<<endl;
		}
		else if(cnt1>=1&&cnt2>=2){
			cout<<"YES"<<endl;
		}
		else{
			cout<<"NO"<<endl;
		}
	}
}
int main(){
	//freopen("in.txt", "r", stdin);//�ύ��ʱ��Ҫע�͵�
	ios::sync_with_stdio(false);//����iostream������������棬��ʡʱ�䡣
	cin.tie(0); cout.tie(0);//����ͨ��tie(0)��0��ʾNULL�������cin��cout�İ󶨣���һ���ӿ�ִ��Ч�ʡ�
	solve();
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c6=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2) c2++;
      else if(count[x]==4) c4++,c2++;
      else if(count[x]==6) c6++,c2++;
      else if(count[x]==8) c8++,c4++,c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2) c2++;
         else if(count[x]==4) c4++,c2++;
         else if(count[x]==6) c6++,c2++;
         else if(count[x]==8) c8++,c4++,c2++;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5) c2--;
         else if(count[x]==3) c4--,c2--;
         else if(count[x]==5) c6--,c2--;
         else if(count[x]==7) c8--,c4--,c2--;
      }
      if(c8||(c2>=4&&(c4||c6))) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2||count[x]==6) c2++;
      else if(count[x]==4) c4++,c2--;
      else if(count[x]==8) c8++,c4--,c2--;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2||count[x]==6) c2++;
         else if(count[x]==4) c4++,c2--;
         else if(count[x]==8) c8++,c4--,c2--;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5) c2--;
         else if(count[x]==3) c4--,c2++;
         else if(count[x]==7) c8--,c4++,c2++;
      }
      if(c8||c4>=2||c2>=8||(c4==1&&c2>=2)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]%4==0) c4++,c2--;
      else if(count[x]%2==0) c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]%4==0) c4++,c2--;
         else if(count[x]%2==0) c2++;
      }
      else{
         count[x]--;
         if((count[x]+1)%4==0) c4--,c2++;
         else if((count[x]+1)%2==0) c2--;
      }
      if(c4>=2||(c4&&c2>=2)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2||count[x]==6) c2++;
      else if(count[x]==4) c4++,c2++;
      else if(count[x]==8) c8++,c4++,c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2||count[x]==6) c2++;
         else if(count[x]==4) c4++,c2++;
         else if(count[x]==8) c8++,c4++,c2++;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5) c2--;
         else if(count[x]==3) c4--,c2--;
         else if(count[x]==7) c8--,c4--,c2--;
      }
      if(c8||(c4&&c2-2>=2)||c2>=4) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},m=0;
    char c;
    cin>>n;
    set<int> sq,rec;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==4){
        sq.insert(x);
        rec.erase(x);
      }
      else if(count[x]==2||count[x]>=6)
        rec.insert(x);
      if(count[x]==8) m++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2||count[x]>=6)
           rec.insert(x);
         else if(count[x]==4){
           sq.insert(x);
           rec.erase(x);
         }
         if(count[x]==8) m++;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5)
           rec.erase(x);
         else if(count[x]==3){
           sq.erase(x);
           rec.insert(x);
         }
         if(count[x]==7) m--;
      }
      if(sq.size()>=2||rec.size()>=4||(sq.size()==1&&rec.size()>=2)||m)
        cout<<"YES\n";
      else
        cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c8=0;
    char c;
    cin>>n;
    set<int> sq,rec;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2) c2++;
      else if(count[x]==4){
         c4++,c2--;
      }
      else if(count[x]==6) c2++;
      else if(count[x]==8) c8++,c2--;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2) c2++;
         else if(count[x]==4){
            c4++,c2--;
         }
         else if(count[x]==6) c2++;
         else if(count[x]==8) c8++;
      }
      else{
         count[x]--;
         if(count[x]==1) c2--;
         else if(count[x]==3) c4--,c2++;
         else if(count[x]==5) c2--;
         else if(count[x]==7) c4++,c8--;
      }
      if(c8||c4>=2||c2>=8||(c4==1&&c2>=2)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]%4==0) c4++,c2--;
      else if(count[x]%2==0) c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]%4==0) c4++,c2--;
         else if(count[x]%2==0) c2++;
      }
      else{
         count[x]--;
         if((count[x]+1)%4==0) c4--,c2++;
         else if((count[x]+1)%2==0) c2--;
      }
      if(c4>=2||c2>=4||(c4>=1&&c2>=2)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c6=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2) c2++;
      else if(count[x]==4) c4++,c2++;
      else if(count[x]==6) c6++,c2++;
      else if(count[x]==8) c8++,c4++,c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2) c2++;
         else if(count[x]==4) c4++,c2++;
         else if(count[x]==6) c6++,c2++;
         else if(count[x]==8) c8++,c4++,c2++;
      }
      else{
         count[x]--;
         if(count[x]==1) c2--;
         else if(count[x]==3) c4--,c2--;
         else if(count[x]==5) c6--,c2--;
         else if(count[x]==7) c8--,c4--,c2--;
      }
      if(c8||(c2>=4&&(c4||c6))) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c6=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2) c2++;
      else if(count[x]==4) c4++,c2++;
      else if(count[x]==6) c6++,c2++;
      else if(count[x]==8) c8++,c4++,c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2) c2++;
         else if(count[x]==4) c4++,c2++;
         else if(count[x]==6) c6++,c2++;
         else if(count[x]==8) c8++,c4++,c2++;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5) c2--;
         else if(count[x]==3) c4--,c2--;
         else if(count[x]==5) c6--,c2--;
         else if(count[x]==7) c8--,c4--,c2--;
      }
      if(c8||(c2-3&&c6)||(c2-2>1&&c4)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0,c6=0,c8=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]==2) c2++;
      else if(count[x]==4) c4++,c2++;
      else if(count[x]==6) c6++,c2++;
      else if(count[x]==8) c8++,c4++,c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]==2) c2++;
         else if(count[x]==4) c4++,c2++;
         else if(count[x]==6) c6++,c2++;
         else if(count[x]==8) c8++,c4++,c2++;
      }
      else{
         count[x]--;
         if(count[x]==1||count[x]==5) c2--;
         else if(count[x]==3) c4--,c2--;
         else if(count[x]==5) c6--,c2--;
         else if(count[x]==7) c8--,c4--,c2--;
      }
      if(c8||(c2>=4&&c4)||(c2>=4&&c6)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,i,q,x,count[100001]={0},c2=0,c4=0;
    char c;
    cin>>n;
    for(i=0;i<n;i++){
      cin>>x;
      count[x]++;
      if(count[x]%4==0) c4++,c2--;
      else if(count[x]%2==0) c2++;
    }
    cin>>q;
    while(q--){
      cin>>c>>x;
      if(c=='+'){
         count[x]++;
         if(count[x]%4==0) c4++,c2--;
         else if(count[x]%2==0) c2++;
      }
      else{
         count[x]--;
         if((count[x]+1)%4==0) c4--,c2++;
         else if((count[x]+1)%2==0) c2--;
      }
      if(c4>=2||c2>=4||(c4==1&&c2>=2)) cout<<"YES\n";
      else cout<<"NO\n";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
                break;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

int main() {
    solve2();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

int contains(vector<pair<int,int>> &planks, int plank) {
    sort(planks.begin(), planks.end(), compare);
    int l = 0;
    int r = planks.size() - 1;
    while (l <= r) {
        int k = (l + r) / 2;
        if (planks[k].first == plank)
            return k;
        if (planks[k].first > plank)
            r = k - 1;
        else
            l = k + 1;
    }
    return -1;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks;
    int plank;
    int pos = -1;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        pos = contains(planks, plank);
        if (pos != -1)
            planks[pos].second++;
        else
            planks.push_back({plank, 1});
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = -1;
        for (int j = 0; j < planks.size(); j++) {
            if (planks[j].first == x) {
                index = j;
                break;
            }
            if (planks[j].first == 0)
                break;
        }
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
            if (index != 0) {
                if (planks[index - 1].second < planks[index].second || planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            } else {
                if (planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            }
        } else {
            planks.push_back({x, 1});
            sort(planks.begin(), planks.end(), compare);
        }
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
        if (!s && !sec)
            cout << "NO\n";
    }
}

int main() {
    solve3();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks(n + 1);
    int plank;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        planks[plank].first = plank;
        planks[plank].second++;
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = -1;
        for (int j = 0; j < n; j++)
            if (planks[j].first == x)
                index = j;
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
            if (index != 0) {
                if (planks[index - 1].second < planks[index].second || planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            }
        } else {
            planks.push_back({x, 1});
            sort(planks.begin(), planks.end(), compare);
        }
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            cout << "NO\n";
        }
        if (!s && !sec)
            cout << "NO\n";
    }
}

int main() {
    solve3();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

int main() {
    solve2();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

bool compare2(pair<int, int> &a, pair<int, int> &b) {
    return a.first < b.first;
}

int contains(vector<pair<int,int>> &planks, int plank) {
    sort(planks.begin(), planks.end(), compare2);
    int l = 0;
    int r = planks.size() - 1;
    while (l <= r) {
        int k = (l + r) / 2;
        if (planks[k].first == plank)
            return k;
        if (planks[k].first > plank)
            r = k - 1;
        else
            l = k + 1;
    }
    return -1;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks;
    int plank;
    int pos = -1;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        pos = contains(planks, plank);
        if (pos != -1)
            planks[pos].second++;
        else
            planks.push_back({plank, 1});
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = contains(planks, x);
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
        } else {
            planks.push_back({x, 1});
        }
        sort(planks.begin(), planks.end(), compare);
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0 || planks[k].second < 2)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
        if (!s && !sec)
            cout << "NO\n";
    }
}

int main() {
    solve3();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

bool compare2(pair<int, int> &a, pair<int, int> &b) {
    return a.first < b.first;
}

int contains(vector<pair<int,int>> &planks, int plank) {
    sort(planks.begin(), planks.end(), compare2);
    int l = 0;
    int r = planks.size() - 1;
    while (l <= r) {
        int k = (l + r) / 2;
        if (planks[k].first == plank)
            return k;
        if (planks[k].first > plank)
            r = k - 1;
        else
            l = k + 1;
    }
    return -1;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks;
    int plank;
    int pos = -1;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        pos = contains(planks, plank);
        if (pos != -1)
            planks[pos].second++;
        else
            planks.push_back({plank, 1});
    }
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = contains(planks, x);
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
        } else {
            planks.push_back({x, 1});
        }
        sort(planks.begin(), planks.end(), compare);
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0 || planks[k].second < 2)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
        if (!s && !sec)
            cout << "NO\n";
    }
}

pair<int, int> search_two(vector<pair<int, int>> &planks, int avoid) {
    pair<int, int> res = {-1, -1};
    int l = 1;
    int r = planks.size() - 1;
    while (l <= r) {
        int k = (l + r) / 2;
        if (planks[k].second >= 4)
            return {4, k};
        else
            r = k - 1;
    }
    l = 1;
    r = planks.size() - 1;
    while (l <= r) {
        int k = (l + r) / 2;
        if (planks[k].second >= 2 && k != avoid) {
            return {2, k};
        } else {
            r = k - 1;
        }
    }
    return res;
}

void solve4() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks;
    int plank;
    int pos = -1;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        pos = contains(planks, plank);
        if (pos != -1)
            planks[pos].second++;
        else
            planks.push_back({plank, 1});
    }
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = contains(planks, x);
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
        } else {
            planks.push_back({x, 1});
        }
        sort(planks.begin(), planks.end(), compare);
        bool s = false;
        bool first = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            pair<int, int> res = search_two(planks, 0);
            if (res.first == 4) {
                cout << "YES\n";
            } else if (res.first == 2) {
                if (first) {
                    cout << "YES\n";
                } else {
                    first = true;
                    res = search_two(planks, res.second);
                    if (res.first != -1) {
                        cout << "YES\n";
                    } else {
                        cout << "NO\n";
                    }
                }
            } else {
                cout << "NO\n";
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
    }
}

int main() {
    solve4();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks(n + 1);
    int plank;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        planks[plank].first = plank;
        planks[plank].second++;
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = -1;
        for (int j = 0; j < n; j++)
            if (planks[j].first == x)
                index = j;
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
            if (index != 0) {
                if (planks[index - 1].second < planks[index].second || planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            } else {
                if (planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            }
        } else {
            planks.push_back({x, 1});
            sort(planks.begin(), planks.end(), compare);
        }
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        if (!s && !sec)
            cout << "NO\n";
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
    }
}

int main() {
    solve3();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

int contains(vector<pair<int,int>> &planks, int plank) {
    int n = planks.size();
    for (int i = 0; i < n; i++)
        if (planks[i].first == plank)
            return i;
    return -1;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks;
    int plank;
    int pos = -1;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        pos = contains(planks, plank);
        if (pos != -1)
            planks[pos].second++;
        else
            planks.push_back({plank, 1});
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = -1;
        for (int j = 0; j < planks.size(); j++) {
            if (planks[j].first == x) {
                index = j;
                break;
            }
            if (planks[j].first == 0)
                break;
        }
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
            if (index != 0) {
                if (planks[index - 1].second < planks[index].second || planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            } else {
                if (planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            }
        } else {
            planks.push_back({x, 1});
            sort(planks.begin(), planks.end(), compare);
        }
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 4) {
                cout << "YES\n";
                continue;
            }
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            //sort(planks.begin(), planks.end(), compare);
            continue;
        }
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
        if (!s && !sec)
            cout << "NO\n";
    }
}

int main() {
    solve3();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int si = 1e5 + 5;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int plank = 0;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        planks[plank]++;
    }
    char option;
    int x;
    int q = 0;
    cin >> q;
    int square = 0, rect = 0;
    for (const auto &p : planks) {
        square += p.second / 4;
        rect += p.second / 2;
    }
    for (int i = 0; i < q; i++) {
        for (const auto &p : planks) {
            cout << p.first << " " << p.second << '\n';
        }
        cin >> option;
        cin >> x;
        square -= planks[x] / 4;
        rect -= planks[x] / 2;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        square += planks[x] / 4;
        rect += planks[x] / 2;
        if (square >= 2) {
            cout << "YES\n";
        } else if (square == 1 && (rect - square * 2) >= 2) {
            cout << "YES\n";
        } else {
            cout << "NO\n";
        }
    }
}

int main() {
    solve();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n = 0;
    cin >> n;
    unordered_map<int, int> planks;
    int length = 0;
    for (int i = 0; i < n; i++) {
        cin >> length;
        planks[length]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            planks[x]++;
        else
            planks[x]--;
        int chosen = -1;
        for (auto &plank : planks) {
            if (plank.second >= 4) {
                square = true; chosen = plank.first;
                planks[chosen] -= 4;
                break;
            }
        }
        if (square) {
            int a = -1, b = -1;
            for (const auto &plank : planks) {
                if (plank.second >= 4) {
                    rect = true;
                    break;
                }
                if (plank.second >= 2 && a == -1)
                    a = plank.first;
                if (plank.second >= 2 && a != -1 && a != plank.first && b == -1) {
                    b = plank.first;
                    rect = true;
                    break;
                }
            }
            planks[chosen] += 4;
        }
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

void solve2() {
    int n = 0;
    cin >> n;
    vector<int> planks(n);
    for (int i = 0; i < n; i++) {
        cin >> planks[i];
    }
    sort(planks.rbegin(), planks.rend());
    map<int, int> ocurrences;
    for (auto plank : planks) {
        ocurrences[plank]++;
    }
    int q = 0;
    cin >> q;
    char option;
    int x = 0;
    bool square = false, rect = false;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        if (option == '+')
            ocurrences[x]++;
        else
            ocurrences[x]--;
        int chosen = -1;
        int a = -1;
        for (auto &o : ocurrences) {
            if (o.second >= 4 && !square) {
                square = true; chosen = o.first;
                ocurrences[chosen] -= 4;
            }
            if (o.second >= 4 && chosen != -1) {
                rect = true;
                break;
            }
            if (o.second >= 2 && a == -1) {
                a = o.first;
                ocurrences[o.first] -= 2;
            }
            if (o.second >= 2 && a != -1) {
                rect = true;
            }
        }
        if (chosen != -1)
            ocurrences[chosen] += 4;
        if (a != -1)
            ocurrences[a] += 2;
        cout << (square && rect ? "YES" : "NO") << '\n';
        square = false; rect = false;
    }
}

bool compare(pair<int, int> &a, pair<int, int> &b) {
    return a.second >= b.second;
}

void solve3() {
    int n = 0;
    cin >> n;
    vector<pair<int, int>> planks(n + 1);
    int plank;
    for (int i = 0; i < n; i++) {
        cin >> plank;
        planks[plank].first = plank;
        planks[plank].second++;
    }
    sort(planks.begin(), planks.end(), compare);
    int q = 0;
    cin >> q;
    char option;
    int x;
    for (int i = 0; i < q; i++) {
        cin >> option;
        cin >> x;
        int index = -1;
        for (int j = 0; j < n; j++)
            if (planks[j].first == x)
                index = j;
        int change = 0;
        if (option == '+')
            change = 1;
        else
            change = -1;
        if (index != -1) {
            planks[index].second += change;
            if (index != 0) {
                if (planks[index - 1].second < planks[index].second || planks[index + 1].second > planks[index].second) {
                    sort(planks.begin(), planks.end(), compare);
                }
            }
        } else {
            planks.push_back({x, 1});
            sort(planks.begin(), planks.end(), compare);
        }
        bool s = false;
        bool first = false, sec = false;
        if (planks[0].second >= 4) {
            int ocurrences = -1;
            if (planks[0].second - 4 >= 2)
                first = true;
            for (int k = 1; k < planks.size(); k++) {
                if (planks[k].first == 0)
                    break;
                ocurrences = planks[k].second;
                if (ocurrences >= 4) {
                    s = true;
                    cout << "YES\n";
                    break;
                } else if (ocurrences >= 2){
                    if (first) {
                        sec = true;
                        cout << "YES\n";
                        break;
                    } else {
                        first = true;
                    }
                }
            }
        } else {
            /*for (auto &x : planks) {
                if (x.first != 0)
                    cout << x.first << " " << x.second << '\n';
            }*/
            cout << "NO\n";
            sort(planks.begin(), planks.end(), compare);
            continue;
        }
        if (!s && !sec)
            cout << "NO\n";
        /*for (auto &x : planks) {
            if (x.first != 0)
                cout << x.first << " " << x.second << '\n';
        }*/
    }
}

int main() {
    solve3();
    return 0;
}