This year in Equestria was a year of plenty, so Applejack has decided to build some new apple storages. According to the advice of the farm designers, she chose to build two storages with non-zero area: one in the shape of a square and another one in the shape of a rectangle (which possibly can be a square as well).

Applejack will build the storages using planks, she is going to spend exactly one plank on each side of the storage. She can get planks from her friend's company. Initially, the company storehouse has $n$ planks, Applejack knows their lengths. The company keeps working so it receives orders and orders the planks itself. Applejack's friend can provide her with information about each operation. For convenience, he will give her information according to the following format:

  $+$ $x$: the storehouse received a plank with length $x$  $-$ $x$: one plank with length $x$ was removed from the storehouse (it is guaranteed that the storehouse had some planks with length $x$). 

Applejack is still unsure about when she is going to order the planks so she wants to know if she can order the planks to build rectangular and square storages out of them after every event at the storehouse. Applejack is busy collecting apples and she has completely no time to do the calculations so she asked you for help!

We remind you that all four sides of a square are equal, and a rectangle has two pairs of equal sides.


-----Input-----

The first line contains a single integer $n$ ($1 \le n \le 10^5$): the initial amount of planks at the company's storehouse, the second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^5$): the lengths of the planks.

The third line contains a single integer $q$ ($1 \le q \le 10^5$): the number of events in the company. Each of the next $q$ lines contains a description of the events in a given format: the type of the event (a symbol $+$ or $-$) is given first, then goes the integer $x$ ($1 \le x \le 10^5$).


-----Output-----

After every event in the company, print "YES" if two storages of the required shape can be built from the planks of that company's set, and print "NO" otherwise. You can print each letter in any case (upper or lower).


-----Example-----
Input
6
1 1 1 2 1 1
6
+ 2
+ 1
- 1
+ 2
- 1
+ 2

Output
NO
YES
NO
NO
NO
YES



-----Note-----

After the second event Applejack can build a rectangular storage using planks with lengths $1$, $2$, $1$, $2$ and a square storage using planks with lengths $1$, $1$, $1$, $1$.

After the sixth event Applejack can build a rectangular storage using planks with lengths $2$, $2$, $2$, $2$ and a square storage using planks with lengths $1$, $1$, $1$, $1$.

Difficulty: MEDIUM

Solutions:
n = int(input())
arr = list(map(int, input().split()))
dic = {}
ans = {8: 0, 2: 0, 6: 0, 4: 0}
for i in arr:
	if dic.get(i, -1) == -1:
		dic[i] = 1
	else:
		dic[i] += 1
for i in dic:
	if dic[i] >= 8:
		ans[8] += 1
	if dic[i] >= 6:
		ans[6] += 1
	if dic[i] >= 4:
		ans[4] += 1
	if dic[i] >= 2:
		ans[2] += 1
for i in range(int(input())):
	(s, x) = input().split()
	flag = False
	if s == '+':
		x = int(x)
		if dic.get(x, -1) != -1:
			if dic[x] == 7:
				ans[8] += 1
			elif dic[x] == 5:
				ans[6] += 1
			elif dic[x] == 3:
				ans[4] += 1
			elif dic[x] == 1:
				ans[2] += 1
			dic[x] += 1
		else:
			dic[x] = 1
		if ans[8] >= 1:
			flag = True
		elif ans[6] >= 1 and ans[2] >= 2:
			flag = True
		elif ans[4] >= 2:
			flag = True
		elif ans[4] >= 1 and ans[2] >= 3:
			flag = True
	else:
		x = int(x)
		if dic[x] == 8:
			ans[8] -= 1
		elif dic[x] == 6:
			ans[6] -= 1
		elif dic[x] == 4:
			ans[4] -= 1
		elif dic[x] == 2:
			ans[2] -= 1
		dic[x] -= 1
		if ans[8] >= 1:
			flag = True
		elif ans[6] >= 1 and ans[2] >= 2:
			flag = True
		elif ans[4] >= 2:
			flag = True
		elif ans[4] >= 1 and ans[2] >= 3:
			flag = True
	if flag:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
d1 = {}
left = {}
for i in a:
	if i in d1.keys():
		d1[i] = d1[i] + 1
		left[i] = left[i] + 1
	else:
		d1[i] = 1
		left[i] = 1
ans = 'NO'
sqd = set()
sqrec = set()
sq = set()
rec = set()
for i in list(d1.keys()):
	if left[i] >= 8:
		left[i] = left[i] - 8
		sqd.add(i)
	elif left[i] >= 6:
		left[i] = left[i] - 6
		sqrec.add(i)
	elif left[i] >= 4:
		left[i] = left[i] - 4
		sq.add(i)
	elif left[i] >= 2:
		left[i] = left[i] - 2
		rec.add(i)
if len(sqd) >= 1 or len(sqrec) >= 2 or (len(sqrec) >= 1 and (len(rec) >= 1 or len(sq) >= 1)) or (len(sq) >= 1 and len(rec) >= 2) or (len(sq) >= 2):
	ans = 'YES'
m = int(input())
for j in range(0, m):
	q = input()
	if q[0] == '+':
		k = int(q[2:])
		if k in left.keys():
			left[k] = left[k] + 1
			d1[k] = d1[k] + 1
		else:
			left[k] = 1
			d1[k] = 1
		if d1[k] == 8:
			left[k] = left[k] - 2
			sqd.add(k)
			sqrec.remove(k)
		elif d1[k] == 6:
			left[k] = left[k] - 2
			sq.remove(k)
			sqrec.add(k)
		elif d1[k] == 4:
			left[k] = left[k] - 2
			sq.add(k)
			rec.remove(k)
		elif d1[k] == 2:
			left[k] = left[k] - 2
			rec.add(k)
		if len(sqd) >= 1 or len(sqrec) >= 2 or (len(sqrec) >= 1 and (len(rec) >= 1 or len(sq) >= 1)) or (len(sq) >= 1 and len(rec) >= 2) or (len(sq) >= 2):
			ans = 'YES'
		else:
			ans = 'NO'
		print(ans)
	else:
		k = int(q[2:])
		if k in left.keys():
			left[k] = left[k] - 1
			d1[k] = d1[k] - 1
		if left[k] == -1:
			if d1[k] == 7:
				left[k] = left[k] + 2
				sqd.remove(k)
				sqrec.add(k)
			elif d1[k] == 5:
				left[k] = left[k] + 2
				sq.add(k)
				sqrec.remove(k)
			elif d1[k] == 3:
				left[k] = left[k] + 2
				sq.remove(k)
				rec.add(k)
			elif d1[k] == 1:
				left[k] = left[k] + 2
				rec.remove(k)
		if len(sqd) >= 1 or len(sqrec) >= 2 or (len(sqrec) >= 1 and (len(rec) >= 1 or len(sq) >= 1)) or (len(sq) >= 1 and len(rec) >= 2) or (len(sq) >= 2):
			ans = 'YES'
		else:
			ans = 'NO'
		print(ans)


import sys, math, heapq, collections, itertools, bisect
sys.setrecursionlimit(101000)
n = int(input())
a = list(map(int, input().split()))
f = [0] * (10 ** 5 + 5)
f2 = [0]
f4 = [0]
f6 = [0]
f8 = [0]

def _set(s, x):
	if s == '+':
		f[x] += 1
		if f[x] == 2:
			f2[0] += 1
		elif f[x] == 4:
			f4[0] += 1
		elif f[x] == 6:
			f6[0] += 1
		elif f[x] == 8:
			f8[0] += 1
	else:
		f[x] -= 1
		if f[x] == 7:
			f8[0] -= 1
		elif f[x] == 5:
			f6[0] -= 1
		elif f[x] == 3:
			f4[0] -= 1
		elif f[x] == 1:
			f2[0] -= 1

def _can():
	if f8[0] > 0:
		return True
	if f6[0] > 1 or f4[0] > 1:
		return True
	if f6[0] == 1 and f2[0] > 1:
		return True
	if f4[0] == 1 and f2[0] > 2:
		return True
	return False
for x in a:
	_set('+', x)
q = int(input())
for _ in range(q):
	(s, x) = input().split()
	_set(s, int(x))
	print('YES' if _can() else 'NO')


n = int(input())
li = list(map(int, input().split()))
d = {}
c = 0
c4 = 0
for i in li:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
	if d[i] % 2 == 0:
		c += 1
	if d[i] % 4 == 0:
		c4 += 1
q = int(input())
for i in range(q):
	(a, b) = map(str, input().split())
	b = int(b)
	if a == '+':
		if b not in d:
			d[b] = 0
		if d[b] % 2 != 0:
			c += 1
		if d[b] % 4 == 3:
			c4 += 1
		if b not in d:
			d[b] = 1
		else:
			d[b] += 1
	else:
		if d[b] % 2 == 0:
			c -= 1
		if d[b] % 4 == 0:
			c4 -= 1
		d[b] -= 1
	if c4 > 1 or (c >= 4 and c4 == 1):
		print('YES')
	else:
		print('NO')


from sys import stdin
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
q = int(stdin.readline())
lis = [0] * (10 ** 5 + 10)
four = 0
two = 0
for i in a:
	lis[i] += 1
	if lis[i] % 2 == 0:
		two += 1
	if lis[i] % 4 == 0:
		four += 1
for loop in range(q):
	(c, l) = stdin.readline().split()
	l = int(l)
	if c == '+':
		lis[l] += 1
		if lis[l] % 2 == 0:
			two += 1
		if lis[l] % 4 == 0:
			four += 1
	else:
		if lis[l] % 2 == 0:
			two -= 1
		if lis[l] % 4 == 0:
			four -= 1
		lis[l] -= 1
	if four >= 1 and two >= 4:
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
l1 = [0] * 100003
for i in range(n):
	l1[l[i]] += 1
l2 = [0] * 10
for i in range(len(l1)):
	if l1[i] != 0:
		if l1[i] > 8:
			l2[9] += 1
		else:
			l2[l1[i]] += 1
for _ in range(int(input())):
	(s1, s2) = map(str, input().split())
	if s1 == '+':
		if l1[int(s2)] > 8:
			l2[9] -= 1
		else:
			l2[l1[int(s2)]] -= 1
		l1[int(s2)] += 1
		if l1[int(s2)] > 8:
			l2[9] += 1
		else:
			l2[l1[int(s2)]] += 1
	else:
		if l1[int(s2)] > 8:
			l2[9] -= 1
		else:
			l2[l1[int(s2)]] -= 1
		l1[int(s2)] -= 1
		if l1[int(s2)] > 8:
			l2[9] += 1
		else:
			l2[l1[int(s2)]] += 1
	(p, q, r, s) = (l2[2] + l2[3], l2[4] + l2[5], l2[6] + l2[7], l2[8] + l2[9])
	if s >= 1:
		print('YES')
	elif r >= 2:
		print('YES')
	elif q >= 1 and r >= 1:
		print('YES')
	elif p >= 2 and q >= 1:
		print('YES')
	elif p >= 1 and r >= 1:
		print('YES')
	elif q >= 2:
		print('YES')
	else:
		print('NO')


def apple(four, two, z):
	if not four:
		print('NO')
	elif len(four) >= 2:
		print('YES')
	else:
		for i in four:
			if z[i] >= 8:
				print('YES')
			elif z[i] >= 6:
				if not two:
					print('NO')
				else:
					print('YES')
			elif len(two) >= 2:
				print('YES')
			else:
				print('NO')
import collections
n = int(input())
A = [int(i) for i in input().split()][:n]
z = collections.Counter(A)
four = set()
two = set()
for i in z.keys():
	if z[i] >= 4:
		four.add(i)
	elif z[i] >= 2 and z[i] < 4:
		two.add(i)
q = int(input())
for i in range(q):
	(x, y) = input().split()
	if x == '+':
		z[int(y)] += 1
		if z[int(y)] == 4:
			four.add(int(y))
			if int(y) in two:
				two.remove(int(y))
		elif z[int(y)] == 2:
			two.add(int(y))
	else:
		z[int(y)] -= 1
		if z[int(y)] == 3:
			four.remove(int(y))
			two.add(int(y))
		elif z[int(y)] == 1:
			two.remove(int(y))
	apple(four, two, z)


def is_good(eights, sixes, fours, twos):
	if eights > 0:
		return True
	if sixes > 0 and sixes + fours + twos >= 2:
		return True
	if fours >= 2:
		return True
	if fours == 1 and twos >= 2:
		return True
	return False

def main():
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	eights = sixes = fours = twos = 0
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	for k in d:
		v = d[k]
		if v >= 8:
			eights += 1
		elif v == 6 or v == 7:
			sixes += 1
		elif v == 4 or v == 5:
			fours += 1
		elif v == 2 or v == 3:
			twos += 1
	q = int(input())
	for _ in range(q):
		(sign, x) = input().split()
		x = int(x)
		if sign == '+':
			if x in d:
				if d[x] == 7:
					eights += 1
					sixes -= 1
				elif d[x] == 5:
					sixes += 1
					fours -= 1
				elif d[x] == 3:
					fours += 1
					twos -= 1
				elif d[x] == 1:
					twos += 1
				d[x] += 1
			else:
				d[x] = 1
		elif d[x] == 1:
			del d[x]
		else:
			if d[x] == 8:
				eights -= 1
				sixes += 1
			elif d[x] == 6:
				sixes -= 1
				fours += 1
			elif d[x] == 4:
				fours -= 1
				twos += 1
			elif d[x] == 2:
				twos -= 1
			d[x] -= 1
		if is_good(eights, sixes, fours, twos):
			print('YES')
		else:
			print('NO')
main()


import sys
sys.setrecursionlimit(10000)
n = int(input())
my_dict = {}
four_same = 0
two_same = 0
a = list(map(int, input().split()))
for i in a:
	if i in my_dict:
		my_dict[i] += 1
		if my_dict[i] % 4 == 0:
			four_same += 1
			two_same -= 1
		elif my_dict[i] % 2 == 0:
			two_same += 1
	else:
		my_dict[i] = 1
q = int(input())
for _ in range(q):
	(symbol, x) = input().split()
	x = int(x)
	if symbol == '+':
		if x in my_dict:
			my_dict[x] += 1
			if my_dict[x] % 4 == 0:
				four_same += 1
				two_same -= 1
			elif my_dict[x] % 2 == 0:
				two_same += 1
		else:
			my_dict[x] = 1
	else:
		if my_dict[x] % 4 == 0:
			four_same -= 1
			two_same += 1
		elif my_dict[x] % 2 == 0:
			two_same -= 1
		my_dict[x] -= 1
	if four_same == 1 and two_same > 1:
		print('YES')
	elif four_same > 1:
		print('YES')
	else:
		print('NO')


def check(tem2, tem4):
	if tem4 < 1:
		return False
	if tem4 >= 2:
		return True
	if tem2 >= 4:
		return True
	return False
num = int(input())
init = input().split()
dic = {}
tem4 = 0
tem2 = 0
resultado = []
for i in init:
	if i in dic:
		tem4 -= int(dic[i] / 4)
		tem2 -= int(dic[i] / 2)
		dic[i] += 1
		tem4 += int(dic[i] / 4)
		tem2 += int(dic[i] / 2)
	else:
		dic[i] = 1
num = int(input())
for i in range(num):
	(a, b) = input().split()
	if a == '+':
		if b in dic:
			tem4 -= int(dic[b] / 4)
			tem2 -= int(dic[b] / 2)
			dic[b] += 1
			tem4 += int(dic[b] / 4)
			tem2 += int(dic[b] / 2)
		else:
			dic[b] = 1
	else:
		tem4 -= int(dic[b] / 4)
		tem2 -= int(dic[b] / 2)
		dic[b] -= 1
		tem4 += int(dic[b] / 4)
		tem2 += int(dic[b] / 2)
	if check(tem2, tem4):
		resultado.append('YES')
	else:
		resultado.append('NO')
print('\n'.join(resultado))


from collections import defaultdict
dd = defaultdict(int)
n = int(input())
ls = list(map(int, input().split()))
for item in ls:
	dd[item] += 1
n = int(input())
s2 = 0
s4 = 0
for item in dd:
	s2 += dd[item] // 2
	s4 += dd[item] // 4
for _ in range(n):
	(op, var) = input().split()
	var = int(var)
	if op == '+':
		s4 -= dd[var] // 4
		s2 -= dd[var] // 2
		dd[var] += 1
		s2 += dd[var] // 2
		s4 += dd[var] // 4
	else:
		s4 -= dd[var] // 4
		s2 -= dd[var] // 2
		dd[var] -= 1
		s2 += dd[var] // 2
		s4 += dd[var] // 4
	if s2 >= 4 and s4 >= 1:
		print('YES')
	else:
		print('NO')


(z, zz, dgraphs) = (input, lambda : list(map(int, z().split())), {})
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
z()
l = zz()
d = {4: 0, 2: 0}
ans = [0] * (10 ** 5 + 1)
for i in l:
	ans[i] += 1
for i in ans:
	d[4] += i // 4
	d[2] += i % 4 // 2
for _ in range(int(z())):
	(a, b) = z().split()
	b = int(b)
	try:
		d[4] -= ans[b] // 4
		d[2] -= ans[b] % 4 // 2
	except:
		pass
	if a == '+':
		try:
			ans[b] += 1
		except:
			ans[b] = 1
	else:
		ans[b] -= 1
	d[4] += ans[b] // 4
	d[2] += ans[b] % 4 // 2
	if d[4] > 1 or (d[4] >= 1 and d[2] > 1):
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
num = list(map(int, input().split()))
(a, x2468) = (Counter(), Counter())

def xanda(x, v):
	if v == '+':
		a[x] += 1
		if a[x] <= 8:
			if a[x] % 2 == 0:
				x2468[a[x] - 2] -= 1
				x2468[a[x]] += 1
	else:
		a[x] -= 1
		if a[x] <= 7:
			if a[x] % 2:
				x2468[a[x] - 1] += 1
				x2468[a[x] + 1] -= 1
for i in range(n):
	xanda(num[i], '+')
q = int(input())
while q >= 1:
	q -= 1
	s = list(input().split())
	xanda(int(s[1]), s[0])
	if x2468[8] or (x2468[6] and x2468[2]) or x2468[6] + x2468[4] >= 2 or (x2468[4] and x2468[2] >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
mex = 10 ** 5 + 5
freq = [0 for i in range(mex)]
for i in arr:
	freq[i] += 1
(m4, m2) = (set(), set())
for i in range(1, mex):
	if freq[i] >= 4:
		m4.add(i)
	elif freq[i] >= 2:
		m2.add(i)
q = int(input())
for _ in range(q):
	x = input().split()
	(x, y) = x
	y = int(y)
	if x == '+':
		freq[y] += 1
		if freq[y] >= 4:
			if y in m2:
				m2.remove(y)
			m4.add(y)
		elif freq[y] >= 2:
			m2.add(y)
	else:
		freq[y] -= 1
		if freq[y] < 4:
			if y in m4:
				m4.remove(y)
			if freq[y] < 2:
				if y in m2:
					m2.remove(y)
			elif freq[y] >= 2:
				m2.add(y)
	f = 0
	if len(m4) != 0:
		p = m4.pop()
		freq[p] -= 4
		if freq[p] >= 4:
			m4.add(p)
		elif freq[p] >= 2:
			m2.add(p)
		if len(m4) != 0:
			f = 1
		elif len(m2) >= 2:
			f = 1
		freq[p] += 4
		if p in m2:
			m2.remove(p)
		m4.add(p)
	if f == 0:
		print('NO')
	else:
		print('YES')


import sys
from collections import Counter
input = sys.stdin.readline
ins = lambda : input().rstrip().split()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().split())
inl = lambda : list(map(int, input().split()))
ans = []
n = ini()
a = inl()
q = ini()
count = dict(Counter(a))
r2 = 0
r4 = 0
for i in count.values():
	r2 += i // 2
	r4 += i // 4
for _ in range(q):
	(p, s) = ins()
	if p == '+':
		if int(s) in count:
			count[int(s)] += 1
		else:
			count[int(s)] = 1
		if count[int(s)] % 2 == 0:
			r2 += 1
		if count[int(s)] % 4 == 0:
			r4 += 1
	else:
		if count[int(s)] % 2 == 0:
			r2 -= 1
		if count[int(s)] % 4 == 0:
			r4 -= 1
		count[int(s)] -= 1
	ans.append('YES' if r2 >= 4 and r4 >= 1 else 'NO')
print('\n'.join(ans))


import re
import sys
exit = sys.exit
from bisect import bisect_left as bsl, bisect_right as bsr
from collections import Counter, defaultdict as ddict, deque
from functools import lru_cache
cache = lru_cache(None)
from heapq import *
from itertools import *
from math import inf
from pprint import pprint as pp
enum = enumerate
ri = lambda : int(rln())
ris = lambda : list(map(int, rfs()))
rln = sys.stdin.readline
rl = lambda : rln().rstrip('\n')
rfs = lambda : rln().split()
mod = 1000000007
d4 = [(0, -1), (1, 0), (0, 1), (-1, 0)]
d8 = [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)]

def ok():
	if s[8]:
		return 1
	elif s[6] >= 2:
		return 1
	elif s[6] and (s[4] >= 2 or s[2] >= 2):
		return 1
	elif s[4] >= 2:
		return 1
	elif s[4] and s[2] >= 3:
		return 1
	else:
		return 0
n = ri()
a = ris()
freq = ddict(int)
s = ddict(int)
for x in a:
	freq[x] += 1
	s[freq[x]] += 1
q = ri()
for _ in range(q):
	(c, x) = rfs()
	x = int(x)
	if c == '-':
		s[freq[x]] -= 1
		freq[x] -= 1
	else:
		freq[x] += 1
		s[freq[x]] += 1
	if ok():
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
ca = [0] * (10 ** 5 + 1)
d = {4: 0, 2: 0}
for i in a:
	ca[i] += 1
for i in ca:
	t = i
	d[4] += t // 4
	t %= 4
	d[2] += t // 2
for _ in range(int(input())):
	q = input().strip().split()
	i = int(q[1])
	t = ca[i]
	d[4] -= t // 4
	t %= 4
	d[2] -= t // 2
	if q[0] == '+':
		ca[i] += 1
	else:
		ca[i] -= 1
	t = ca[i]
	d[4] += t // 4
	t %= 4
	d[2] += t // 2
	if d[4] > 1 or (d[4] == 1 and d[2] > 1):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
planks = [0] * 100000
pairs = 0
squares = 0
for x in a:
	planks[x - 1] += 1
	if planks[x - 1] % 2 == 0:
		pairs += 1
		if planks[x - 1] % 4 == 0:
			squares += 1
for f in range(int(input())):
	inp = list(input().split())
	p = inp[0]
	i = int(inp[1])
	i -= 1
	if p == '+':
		planks[i] += 1
		if planks[i] % 2 == 0:
			pairs += 1
			if planks[i] % 4 == 0:
				squares += 1
	else:
		if planks[i] % 2 == 0:
			pairs -= 1
			if planks[i] % 4 == 0:
				squares -= 1
		planks[i] -= 1
	if squares > 0 and pairs > 3:
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def check(a):
	if a >= 8:
		return 3
	if a >= 6:
		return 2
	if a >= 4:
		return 1
	if a >= 2:
		return 0
	return -1
from sys import stdin, stdout
N = int(stdin.readline())
m = [0, 0, 0, 0, 0]
a = [int(x) for x in stdin.readline().split()]
cnt = defaultdict(int)
for i in a:
	cnt[i] += 1
for (k, v) in cnt.items():
	m[check(v)] += 1
q = int(stdin.readline())
for i in range(q):
	(c, l) = map(str, stdin.readline().split())
	l = int(l)
	if c == '+':
		bf = check(cnt[l])
		cnt[l] += 1
		af = check(cnt[l])
		m[bf] -= 1
		m[af] += 1
	else:
		bf = check(cnt[l])
		cnt[l] -= 1
		af = check(cnt[l])
		m[bf] -= 1
		m[af] += 1
	if m[3] >= 1:
		print('YES')
		continue
	if m[2] >= 1:
		if m[0] >= 1 or m[1] >= 1 or m[2] >= 2:
			print('YES')
			continue
		print('NO')
		continue
	if m[1] >= 1:
		if m[0] >= 2 or m[1] >= 2:
			print('YES')
			continue
		print('NO')
		continue
	print('NO')


from collections import deque
from math import *
import heapq
from random import *
import sys
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
q = int(input())
d = {}
for j in range(len(l)):
	if l[j] not in d:
		d[l[j]] = 1
	else:
		d[l[j]] += 1
square = {}
rectangle = {}
for j in d:
	if d[j] >= 4:
		square[j] = 1
	if d[j] < 4 and d[j] >= 2 or d[j] >= 6:
		rectangle[j] = 1
for j in range(q):
	s = input()
	op = s[0]
	node = int(s[2:])
	if op == '+':
		if node not in d:
			d[node] = 1
		else:
			d[node] += 1
	else:
		d[node] -= 1
	if d[node] >= 4 and node not in square:
		square[node] = 1
	if (d[node] < 4 and d[node] >= 2 or d[node] >= 6) and node not in rectangle:
		rectangle[node] = 1
	if d[node] == 3 and node in square:
		del square[node]
	if (d[node] == 1 or d[node] == 4 or d[node] == 5) and node in rectangle:
		del rectangle[node]
	if len(square) >= 2:
		print('YES')
	if len(square) == 0:
		print('NO')
	if len(square) == 1:
		vv = False
		for j in square:
			if d[j] >= 8:
				vv = True
		if vv == True:
			print('YES')
		elif len(rectangle) > 1:
			print('YES')
		else:
			print('NO')


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	d = defaultdict(int)
	n = ii()
	arr = li()
	for i in arr:
		d[i] += 1
	cnt4 = 0
	cnt2 = 0
	for s in d:
		cnt4 += d[s] // 4
		cnt2 += d[s] // 2
	q = ii()
	ans = ''
	for i in range(q):
		(s, v) = map(str, I().split())
		if s[0] == '+':
			d[int(v)] += 1
			if d[int(v)] % 4 == 0:
				cnt4 += 1
				cnt2 += 1
			elif d[int(v)] % 2 == 0:
				cnt2 += 1
		else:
			if d[int(v)] % 4 == 0:
				cnt4 -= 1
				cnt2 -= 1
			elif d[int(v)] % 2 == 0:
				cnt2 -= 1
			d[int(v)] -= 1
		if cnt4 > 0 and cnt2 >= 4:
			ans += 'YES\n'
		else:
			ans += 'NO\n'
	print(ans)
main()


from sys import stdin, stdout

def input():
	return stdin.readline().strip()
from collections import defaultdict, Counter
N = int(input())
A = list(map(int, input().split()))
smallish = defaultdict(set)
large = Counter()

def add(a):
	for i in range(1, 7):
		if a in smallish[i]:
			smallish[i].remove(a)
			smallish[i + 1].add(a)
			return
	if a in smallish[7]:
		smallish[7].remove(a)
		large[a] = 8
		return
	if a in large:
		large[a] += 1
		return
	smallish[1].add(a)

def remove(a):
	for i in range(2, 8):
		if a in smallish[i]:
			smallish[i].remove(a)
			smallish[i - 1].add(a)
			return
	if a in smallish[1]:
		smallish[1].remove(a)
		return
	if a in large:
		large[a] -= 1
		if large[a] == 7:
			del large[a]
			smallish[7].add(a)
		return
	assert False
for a in A:
	add(a)

def ans():
	if len(large):
		return 'YES'
	if len(smallish[6]) + len(smallish[7]) >= 2:
		return 'YES'
	if len(smallish[6]) + len(smallish[7]) >= 1:
		if sum((len(smallish[i]) for i in range(2, 6))) >= 1:
			return 'YES'
		return 'NO'
	if len(smallish[4]) + len(smallish[5]) >= 2:
		return 'YES'
	if len(smallish[4]) + len(smallish[5]) >= 1:
		if sum((len(smallish[i]) for i in range(2, 4))) >= 2:
			return 'YES'
		return 'NO'
	return 'NO'
for _ in range(int(input())):
	(op, e) = input().split()
	e = int(e)
	if op == '+':
		add(e)
	elif op == '-':
		remove(e)
	else:
		assert False
	print(ans())


import sys
from collections import Counter
input = sys.stdin.readline
n = int(input())
A = list(map(int, input().split()))
q = int(input())
C = Counter(A)
D = {}
for i in range(10):
	D[i] = set()
m = max(C.values())
for i in C.values():
	D[i] = set()
for i in C:
	D[C[i]].add(i)
for i in range(q):
	(z, x) = input().split()
	x = int(x)
	if z == '+':
		if x not in C:
			C[x] = 1
			D[1].add(x)
			m = max(1, m)
		else:
			if C[x] == m and len(D[m]):
				m += 1
			D[C[x]].discard(x)
			C[x] += 1
			if C[x] not in D:
				D[C[x]] = set()
			D[C[x]].add(x)
	else:
		if C[x] == m and len(D[m]) == 1:
			m = -1
		D[C[x]].discard(x)
		C[x] -= 1
		if C[x] not in D:
			D[C[x]] = set()
		D[C[x]].add(x)
		if m == -1:
			for i in range(10):
				if i in D and len(D[i]) > 0:
					m = i
	a = len(D[m])
	b = len(D[7])
	c = len(D[6])
	d = len(D[5])
	e = len(D[4])
	f = len(D[3])
	g = len(D[2])
	F = False
	if m >= 8 and a:
		F = True
	if (m == 7 and b) and c + d + e + f + g > 0 or (m == 7 and b > 1):
		F = True
	if (m == 6 and c) and d + e + f + g > 0 or (m == 6 and c > 1):
		F = True
	if (m == 5 and d) and e + f + g > 1 or (m == 5 and d > 1) or (m == 5 and d == 1 and (e > 0)):
		F = True
	if (m == 4 and e) and f + g > 1 or (m == 4 and e > 1):
		F = True
	if F:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
a = Counter(a)
v = 0
reml = 0
for i in a:
	if a[i] == 4:
		v += 1
	elif a[i] > 4:
		v += a[i] // 4
		rem = a[i] % 4
		if rem >= 2:
			reml += 1
	elif a[i] >= 2:
		reml += 1
for i in range(q):
	(s, x) = input().split()
	x = int(x)
	if x in a:
		if s == '+':
			a[x] += 1
			vn = a[x] // 4
			remn = a[x] % 4
			if remn == 0:
				v += 1
				reml -= 1
			elif remn == 2:
				reml += 1
		else:
			a[x] -= 1
			vn = a[x] // 4
			remn = a[x] % 4
			if remn == 1:
				reml -= 1
			elif remn == 3:
				v -= 1
				reml += 1
	elif s == '+':
		a[x] = 1
	v1 = v + reml // 2
	if v1 >= 2:
		if v == 0:
			print('NO')
		else:
			print('YES')
	else:
		print('NO')


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
lis = [0] * (10 ** 5 + 1)
arry = list(map(int, input().split()))
m = int(input())
two = 0
four = 0
for i in range(n):
	lis[arry[i]] += 1
	if lis[arry[i]] % 2 == 0:
		two += 1
	if lis[arry[i]] % 4 == 0:
		four += 1
for i in range(m):
	(sign, numstr) = input().split()
	if sign == '+':
		lis[int(numstr)] += 1
		if lis[int(numstr)] % 2 == 0:
			two += 1
		if lis[int(numstr)] % 4 == 0:
			four += 1
	else:
		if lis[int(numstr)] % 2 == 0:
			two -= 1
		if lis[int(numstr)] % 4 == 0:
			four -= 1
		lis[int(numstr)] -= 1
	if four >= 1 and two >= 4:
		print('YES')
	else:
		print('NO')


def check1(dpp):
	if dpp[8] >= 1 or dpp[4] >= 2:
		return 'YES'
	elif dpp[6] >= 1 and dpp[2] >= 2:
		return 'YES'
	elif dpp[4] >= 1 and dpp[2] >= 3:
		return 'YES'
	else:
		return 'NO'
n = int(input())
dp = [0] * 131072
dpp = [0] * 131072
arr = list(map(int, input().split()))
for i in arr:
	dp[i] += 1
	dpp[dp[i]] += 1
for _ in range(int(input())):
	(a, b) = input().split()
	if a == '+':
		i = int(b)
		dp[i] += 1
		dpp[dp[i]] += 1
		print(check1(dpp))
	if a == '-':
		i = int(b)
		dpp[dp[i]] -= 1
		dp[i] -= 1
		print(check1(dpp))


n = int(input())
a = list(map(int, input().split()))
q = int(input())
ans = []
lengths = [0] * (10 ** 5 + 1)
counter4 = 0
counter6 = 0
counter8 = 0
counter2 = 0
for i in a:
	lengths[i] += 1
for i in lengths:
	if i >= 8:
		counter8 += 1
	elif i >= 6:
		counter6 += 1
	elif i >= 4:
		counter4 += 1
	elif i >= 2:
		counter2 += 1
for i in range(q):
	inf = list(input().split())
	if inf[0] == '+':
		if lengths[int(inf[1])] == 3:
			counter4 += 1
			counter2 -= 1
		elif lengths[int(inf[1])] == 1:
			counter2 += 1
		elif lengths[int(inf[1])] == 7:
			counter8 += 1
			counter6 -= 1
		elif lengths[int(inf[1])] == 5:
			counter6 += 1
			counter4 -= 1
		lengths[int(inf[1])] += 1
	else:
		if lengths[int(inf[1])] == 4:
			counter4 -= 1
			counter2 += 1
		elif lengths[int(inf[1])] == 2:
			counter2 -= 1
		elif lengths[int(inf[1])] == 6:
			counter6 -= 1
			counter4 += 1
		elif lengths[int(inf[1])] == 8:
			counter8 -= 1
			counter6 += 1
		lengths[int(inf[1])] -= 1
	if counter8 >= 1 or counter6 >= 2 or (counter6 >= 1 and (counter2 >= 1 or counter4 >= 1)) or (counter4 >= 2) or (counter4 >= 1 and counter2 >= 2):
		ans.append('YES')
	else:
		ans.append('NO')
for i in ans:
	print(i)


from collections import Counter
import heapq
from collections import Counter
n = int(input())
arr = list(map(int, input().split()))
m = int(input())
c = Counter(arr)
v1 = []
cnt = 0
for i in c:
	if c[i] >= 4:
		v1.append(i)
	elif c[i] >= 2:
		cnt += 1
for i in range(m):
	s = input().split(' ')
	sym = s[0]
	val = int(s[1])
	if sym == '+':
		c[val] += 1
		if c[val] == 4:
			v1.append(val)
			cnt -= 1
		elif c[val] == 2:
			cnt += 1
	else:
		c[val] -= 1
		if c[val] + 1 == 4:
			v1.remove(val)
			cnt += 1
		elif c[val] == 1:
			cnt -= 1
	if v1:
		if len(v1) == 1:
			if c[v1[0]] >= 8:
				print('YES')
			elif c[v1[0]] >= 6 and cnt >= 1:
				print('YES')
			elif cnt >= 2:
				print('YES')
			else:
				print('NO')
		else:
			print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(lambda : 0)
d1 = {2: 0, 4: 0}
for i in a:
	d[i] += 1
for i in d:
	d1[4] += d[i] // 4
	t = d[i] % 4
	d1[2] += t // 2
q = int(input())
for _ in range(q):
	x = input()
	t = d[int(x[1:])]
	d1[4] -= t // 4
	t = t % 4
	d1[2] -= t // 2
	if x[0] == '+':
		d[int(x[1:])] += 1
	else:
		d[int(x[1:])] -= 1
	t = d[int(x[1:])]
	d1[4] += t // 4
	t = t % 4
	d1[2] += t // 2
	if d1[4] > 1 or (d1[4] == 1 and d1[2] > 1):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math
from collections import Counter, deque, defaultdict
L = lambda : deque(list(map(int, stdin.readline().strip().split())))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
IN = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()
mod = 1000000007

def s(a):
	print(''.join(list(map(str, a))))

def solve():
	n = I()
	l = L()
	d = defaultdict(int)
	d = Counter(l)
	r = s = 0
	for i in d:
		t = d[i]
		if t >= 4:
			s += t // 4
			t = t % 4
		if t >= 2:
			r += 1
	for i in range(I()):
		ans = 'NO'
		(a, b) = input().strip().split()
		b = int(b)
		if a == '+':
			if d[b] % 4 == 3:
				r -= 1
				s += 1
			elif d[b] % 4 == 1:
				r += 1
			d[b] += 1
		else:
			if d[b] % 4 == 2:
				r -= 1
			elif d[b] % 4 == 0:
				r += 1
				s -= 1
			d[b] -= 1
		if s > 1 or (s and r > 1):
			ans = 'YES'
		print(ans)
for _ in range(1):
	solve()


n = int(input())
mylist = list(map(int, input().split()))
mydict = {}
for i in mylist:
	if i in mydict:
		mydict[i] += 1
	else:
		mydict[i] = 1
ansdict = {8: 0, 6: 0, 4: 0, 2: 0}
for i in mydict:
	if mydict[i] >= 8:
		ansdict[8] += 1
	elif mydict[i] >= 6:
		ansdict[6] += 1
	elif mydict[i] >= 4:
		ansdict[4] += 1
	elif mydict[i] >= 2:
		ansdict[2] += 1
for i in range(int(input())):
	templist = input().split()
	templist[1] = int(templist[1])
	if templist[0] == '+':
		if templist[1] in mydict:
			mydict[templist[1]] += 1
		else:
			mydict[templist[1]] = 1
		if mydict[templist[1]] == 8:
			ansdict[8] += 1
			ansdict[6] -= 1
		elif mydict[templist[1]] == 6:
			ansdict[6] += 1
			ansdict[4] -= 1
		elif mydict[templist[1]] == 4:
			ansdict[4] += 1
			ansdict[2] -= 1
		elif mydict[templist[1]] == 2:
			ansdict[2] += 1
	else:
		mydict[templist[1]] -= 1
		if mydict[templist[1]] == 7:
			ansdict[8] -= 1
			ansdict[6] += 1
		elif mydict[templist[1]] == 5:
			ansdict[6] -= 1
			ansdict[4] += 1
		elif mydict[templist[1]] == 3:
			ansdict[4] -= 1
			ansdict[2] += 1
		elif mydict[templist[1]] == 1:
			ansdict[2] -= 1
	if ansdict[8] > 0:
		print('YES')
	elif ansdict[6] > 1:
		print('YES')
	elif ansdict[6] > 0 and (ansdict[4] > 0 or ansdict[2] > 0):
		print('YES')
	elif ansdict[4] > 1:
		print('YES')
	elif ansdict[4] > 0 and ansdict[2] > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
q = int(input())
dic1 = {}
dic2 = {}
for i in range(0, 8 + 1):
	dic2[i] = 0
for i in range(n):
	if arr[i] not in dic1:
		dic1[arr[i]] = 1
		dic2[1] += 1
	else:
		if dic1[arr[i]] < 8:
			dic2[dic1[arr[i]]] -= 1
		dic1[arr[i]] += 1
		if dic1[arr[i]] < 8:
			dic2[dic1[arr[i]]] += 1
		elif dic1[arr[i]] == 8:
			dic2[8] += 1
for _ in range(q):
	(s, a) = input().split()
	a = int(a)
	if s == '+':
		if a not in dic1:
			dic1[a] = 1
			dic2[1] += 1
		else:
			if dic1[a] < 8:
				dic2[dic1[a]] -= 1
			dic1[a] += 1
			if dic1[a] < 8:
				dic2[dic1[a]] += 1
			elif dic1[a] == 8:
				dic2[8] += 1
	else:
		if dic1[a] <= 8:
			dic2[dic1[a]] -= 1
		dic1[a] -= 1
		if dic1[a] < 8:
			dic2[dic1[a]] += 1
	s = 0
	for i in range(4, 8):
		s += dic2[i]
	if dic2[8] >= 1 or s >= 2:
		print('YES')
	elif s == 0:
		print('NO')
	elif dic2[6] == 1 or dic2[7] == 1:
		if dic2[2] + dic2[3] + 1 >= 2:
			print('YES')
		else:
			print('NO')
	elif dic2[2] + dic2[3] >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
l = [int(x) for x in input().split()]
m = int(input())
dici = {}
sq = 0
rect = 0
for i in range(n):
	if l[i] not in dici:
		dici[l[i]] = 1
	else:
		dici[l[i]] += 1
		t = dici[l[i]]
		if t == 2:
			rect += 1
		elif t == 4:
			sq += 1
			rect -= 1
		elif t == 6:
			rect += 1
		elif t == 8:
			rect += 1
for i in range(m):
	st = input()
	if st[0] == '+':
		if int(st[2:]) not in dici:
			dici[int(st[2:])] = 1
		else:
			dici[int(st[2:])] += 1
			j = dici[int(st[2:])]
			if j == 2:
				rect += 1
			elif j == 4:
				rect -= 1
				sq += 1
			elif j == 6:
				rect += 1
			elif j == 8:
				rect += 1
	else:
		dici[int(st[2:])] -= 1
		j = dici[int(st[2:])]
		if j == 1:
			rect -= 1
		elif j == 3:
			sq -= 1
			rect += 1
		elif j == 5:
			rect -= 1
		elif j == 7:
			rect -= 1
	if sq > 1:
		print('YES')
	elif sq == 1 and rect >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
num = list(map(int, input().split()))
(a, sum2, sum4) = (100001 * [0], 0, 0)

def upp(x, v):
	global sum2, sum4
	sum4 -= int(a[x] / 4)
	sum2 -= int(a[x] / 2)
	a[x] += v
	sum4 += int(a[x] / 4)
	sum2 += int(a[x] / 2)
for i in range(n):
	upp(num[i], 1)
q = int(input())
while q >= 1:
	q -= 1
	u = list(input().split())
	if u[0] == '+':
		upp(int(u[1]), 1)
	else:
		upp(int(u[1]), -1)
	if sum4 >= 1 and sum2 >= 4:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
arr = list(map(int, input().split()))
count = dict(Counter(arr))
two = 0
four = 0
for i in count.values():
	two += i // 2
	four += i // 4
t = int(input())
while t:
	t -= 1
	(operation, stick) = input().split()
	stick = int(stick)
	if operation == '+':
		if stick in count:
			count[stick] += 1
		else:
			count[stick] = 1
		if count[stick] % 2 == 0:
			two += 1
		if count[stick] % 4 == 0:
			four += 1
	else:
		if count[stick] % 2 == 0:
			two -= 1
		if count[stick] % 4 == 0:
			four -= 1
		count[stick] -= 1
	if two >= 4 and four >= 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
import math
n = int(input())
a = list(map(int, input().rstrip().split(' ')))
q = int(input())
d = defaultdict(lambda : 0)
for ele in a:
	d[ele] += 1
count4 = 0
count2 = 0
for (key, value) in d.items():
	count4 += value // 4
	value = value % 4
	count2 += value // 2
for _ in range(q):
	(sign, num) = input().rstrip().split(' ')
	num = int(num)
	val = d[num]
	if sign == '+':
		if (val + 1) % 4 == 0:
			count4 += 1
			count2 -= 1
		elif (val + 1) % 2 == 0:
			count2 += 1
		d[num] += 1
	else:
		if val % 4 == 0:
			count4 -= 1
			count2 += 1
		elif val % 2 == 0:
			count2 -= 1
		d[num] -= 1
	if count4 >= 2 or (count4 == 1 and count2 >= 2):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
from collections import defaultdict as dd

def main():

	def inpint():
		return int(input())

	def inpstr():
		return str(input())

	def inparr():
		return list(map(int, input().strip().split()))

	def inptup():
		return map(int, input().strip().split())
	n = inpint()
	a = inparr()
	q = inpint()
	d = dd(lambda : 0)
	sq = 0
	rc = 0
	lol = 0
	for i in a:
		d[i] += 1
		if d[i] == 4:
			sq += 1
			rc -= 1
		elif d[i] == 2:
			rc += 1
		elif d[i] == 6:
			rc += 1
		elif d[i] == 8:
			lol += 1
			sq -= 1
			rc -= 1
	for i in range(q):
		(x, y) = input().split()
		y = int(y)
		if x == '+':
			d[y] += 1
			if d[y] == 4:
				sq += 1
				rc -= 1
			elif d[y] == 2:
				rc += 1
			elif d[y] == 6:
				rc += 1
			elif d[y] == 8:
				lol += 1
				sq -= 1
				rc -= 1
			if rc >= 2 and sq >= 1:
				print('YES')
			elif sq >= 2:
				print('YES')
			elif lol >= 1:
				print('YES')
			else:
				print('NO')
		else:
			d[y] -= 1
			if d[y] == 3:
				sq -= 1
				rc += 1
			elif d[y] == 1:
				rc -= 1
			elif d[y] == 5:
				rc -= 1
			elif d[y] == 7:
				lol -= 1
				sq += 1
				rc += 1
			if rc >= 2 and sq >= 1:
				print('YES')
			elif sq >= 2:
				print('YES')
			elif lol >= 1:
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys

def check():
	(two, four, six, eight) = (0, 0, 0, 0)
	for i in range(1, 9):
		if i == 2 or i == 3:
			two += ind[i]
		if i == 4 or i == 5:
			four += ind[i]
		if i == 6 or i == 7:
			six += ind[i]
		if i >= 8:
			eight += ind[i]
	if four >= 1:
		if four >= 2:
			return True
		if two >= 2:
			return True
		if six >= 1:
			return True
	if six >= 1:
		if two >= 1 or four >= 1:
			return True
		if six >= 2:
			return True
	if eight >= 1:
		return True
	return False
n = int(input())
a = [int(i) for i in input().split()]
length = [0] * (100002 + 1)
for i in range(n):
	length[a[i]] += 1
ind = [0] * 9
for i in length:
	if i > 0:
		if i <= 8:
			ind[i] += 1
		else:
			ind[-1] += 1
q = int(input())
for i in range(q):
	t = input()
	if t[0] == '+':
		pq = int(t[2:])
		ind[min(8, length[pq])] -= 1
		length[pq] += 1
		ind[min(8, length[pq])] += 1
	else:
		pq = int(t[2:])
		ind[min(8, length[pq])] -= 1
		length[pq] -= 1
		ind[min(8, length[pq])] += 1
	if check():
		sys.stdout.write('YES' + '\n')
	else:
		sys.stdout.write('NO' + '\n')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)

def toord(c):
	return ord(c) - ord('a')

def lcm(a, b):
	return a * b // lcm(a, b)
mod = 998244353
INF = float('inf')
from math import factorial, sqrt, ceil, floor, gcd
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	n = N()
	arr = RLL()
	q = N()
	dic = defaultdict(int)
	for i in arr:
		dic[i] += 1
	sq = 0
	twos = 0
	for i in dic:
		sq += dic[i] // 4
		twos += dic[i] // 2
	for _ in range(q):
		s = input().split()
		x = int(s[1])
		bsq = dic[x] // 4
		btw = dic[x] // 2
		if s[0] == '+':
			dic[x] += 1
		else:
			dic[x] -= 1
		nbsq = dic[x] // 4
		nbtw = dic[x] // 2
		sq += nbsq - bsq
		twos += nbtw - btw
		if sq > 1 or (sq > 0 and twos - 2 > 1):
			print('YES')
		else:
			print('NO')
main()


import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
storage = [0 for i in range(10 ** 5 + 1)]
sides = [0 for i in range(9)]
for i in a:
	storage[i] += 1
for i in storage:
	if i >= 8:
		sides[8] += 1
	elif i >= 6:
		sides[6] += 1
	elif i >= 4:
		sides[4] += 1
	elif i >= 2:
		sides[2] += 1
for _ in range(int(input())):
	(ps, s) = input().split()
	size = int(s)
	if ps == '+':
		storage[size] += 1
		if storage[size] == 2:
			sides[2] += 1
		elif storage[size] == 4:
			sides[2] -= 1
			sides[4] += 1
		elif storage[size] == 6:
			sides[4] -= 1
			sides[6] += 1
		elif storage[size] == 8:
			sides[6] -= 1
			sides[8] += 1
	else:
		storage[size] -= 1
		if storage[size] == 1:
			sides[2] -= 1
		elif storage[size] == 3:
			sides[2] += 1
			sides[4] -= 1
		elif storage[size] == 5:
			sides[4] += 1
			sides[6] -= 1
		elif storage[size] == 7:
			sides[6] += 1
			sides[8] -= 1
	if sides[8] != 0:
		print('YES')
	elif sides[6] != 0 and sides[2] + sides[4] + sides[6] > 1:
		print('YES')
	elif sides[4] > 1:
		print('YES')
	elif sides[4] == 1 and sides[2] > 1:
		print('YES')
	else:
		print('NO')


nums = {}
n = int(input())
e = {2: 0, 4: 0, 6: 0, 8: 0}
for a in map(int, input().split()):
	if a in nums:
		nums[a] += 1
		if nums[a] == 8:
			e[8] += 1
			e[6] -= 1
			continue
		if nums[a] == 6:
			e[6] += 1
			e[4] -= 1
			continue
		if nums[a] == 4:
			e[4] += 1
			e[2] -= 1
			continue
		if nums[a] == 2:
			e[2] += 1
	else:
		nums[a] = 1
q = int(input())
for _ in range(q):
	(sign, x) = input().split()
	x = int(x)
	if sign == '+':
		if x in nums:
			nums[x] += 1
			if nums[x] == 8:
				e[8] += 1
				e[6] -= 1
			if nums[x] == 6:
				e[6] += 1
				e[4] -= 1
			if nums[x] == 4:
				e[4] += 1
				e[2] -= 1
			if nums[x] == 2:
				e[2] += 1
		else:
			nums[x] = 1
	else:
		nums[x] -= 1
		if nums[x] == 7:
			e[8] -= 1
			e[6] += 1
		elif nums[x] == 5:
			e[6] -= 1
			e[4] += 1
		elif nums[x] == 3:
			e[4] -= 1
			e[2] += 1
		elif nums[x] == 1:
			e[2] -= 1
	if e[4] + e[6] + e[8] > 0 and e[2] * 2 + e[4] * 4 + e[6] * 6 + e[8] * 8 >= 8:
		print('YES')
	else:
		print('NO')


n = int(input())
A = list(map(int, input().split()))
k = []
cnt = [0] * 10 ** 6
(c2, c4) = (0, 0)
for i in range(n):
	x = A[i]
	c2 -= cnt[x] // 2
	c4 -= cnt[x] // 4
	cnt[x] += 1
	c2 += cnt[x] // 2
	c4 += cnt[x] // 4
for i in range(int(input())):
	(typ, x) = map(str, input().split())
	x = int(x)
	c2 -= cnt[x] // 2
	c4 -= cnt[x] // 4
	if typ == '+':
		cnt[x] += 1
	else:
		cnt[x] -= 1
	c2 += cnt[x] // 2
	c4 += cnt[x] // 4
	if c4 >= 1 and c2 >= 4:
		print('YES')
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
t = 1
for _ in range(t):
	n = ip()
	arr = list(inp())
	dic = Counter(arr)
	flag2 = 0
	flag4 = 0
	for i in dic:
		temp = dic[i]
		flag4 += temp // 4
		temp %= 4
		flag2 += temp // 2
	q = ip()
	for i in range(q):
		ch = list(input().split())
		no = int(ch[1])
		if ch[0] == '+':
			dic[no] += 1
			temp = dic[no] % 4
			if dic[no] >= 4:
				if dic[no] % 4 == 0:
					flag4 += 1
					flag2 -= 1
				elif temp % 2 == 0:
					flag2 += 1
			elif temp == 2:
				flag2 += 1
		else:
			temp = dic[no] % 4
			if dic[no] >= 4:
				if dic[no] % 4 == 0:
					flag4 -= 1
					flag2 += 1
				elif temp % 2 == 0:
					flag2 -= 1
			elif temp == 2:
				flag2 -= 1
			dic[no] -= 1
		if flag4 >= 2:
			print('YES')
		elif flag4 == 1:
			if flag2 >= 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


from sys import stdin, gettrace
from collections import Counter
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def main():
	n = int(inputi())
	aa = [int(a) for a in inputi().split()]
	aac = Counter(aa)
	sv2 = sum((c // 2 for c in aac.values()))
	sv4 = sum((c // 4 for c in aac.values()))
	q = int(inputi())
	for _ in range(q):
		(o, v) = input().split()
		v = int(v)
		if o == '+':
			aac[v] += 1
			if aac[v] % 2 == 0:
				sv2 += 1
				if aac[v] % 4 == 0:
					sv4 += 1
		else:
			if aac[v] % 2 == 0:
				sv2 -= 1
				if aac[v] % 4 == 0:
					sv4 -= 1
			aac[v] -= 1
		if sv4 >= 1 and sv2 >= 4:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = {}
for i in range(n):
	if a[i] not in d:
		d[a[i]] = 1
	else:
		d[a[i]] += 1
sides = 0
chk = False
chk2 = 0
for x in d.keys():
	chk2 += d[x] // 4
	sides += d[x] // 2
for j in range(q):
	s = list(input().split())
	if s[0] == '+':
		if int(s[1]) not in d:
			d[int(s[1])] = 1
		else:
			if d[int(s[1])] % 4 == 3:
				chk2 += 1
			if d[int(s[1])] % 2 == 1:
				sides += 1
			d[int(s[1])] += 1
		n += 1
	else:
		if d[int(s[1])] % 2 == 0:
			sides -= 1
		if d[int(s[1])] % 4 == 0:
			chk2 -= 1
		d[int(s[1])] -= 1
		n -= 1
	if n < 8:
		print('NO')
		continue
	if sides >= 4:
		chk = True
	else:
		chk = False
	if chk and chk2 > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
hashmap = {}
count = {}
for i in range(1, 100000):
	count[i] = 0
for i in range(n):
	if a[i] in hashmap:
		hashmap[a[i]] += 1
		count[hashmap[a[i]]] += 1
	if a[i] not in hashmap:
		hashmap[a[i]] = 1
		count[hashmap[a[i]]] += 1
for item in [0] * int(input()):
	(b, c) = input().split()
	c = int(c)
	if b == '+':
		if c in hashmap:
			hashmap[c] += 1
			count[hashmap[c]] += 1
		if c not in hashmap:
			hashmap[c] = 1
			count[hashmap[c]] += 1
	if b == '-':
		count[hashmap[c]] -= 1
		hashmap[c] -= 1
	if count[8] > 0 or count[4] >= 2 or (count[6] > 0 and count[2] >= 2) or (count[4] > 0 and count[2] >= 3):
		print('YES')
	else:
		print('NO')


q = [0 for i in range(100000)]
(co8, co6, co4, co2) = (0, 0, 0, 0)
input()
for z in map(int, input().split()):
	if q[z - 1] == 3:
		co2 -= 1
	if q[z - 1] == 5:
		co4 -= 1
	if q[z - 1] == 7:
		co6 -= 1
	q[z - 1] += 1
	if q[z - 1] == 2:
		co2 += 1
	if q[z - 1] == 4:
		co4 += 1
	if q[z - 1] == 6:
		co6 += 1
	if q[z - 1] == 8:
		co8 += 1
for t in range(int(input())):
	(c, z) = input().split()
	z = int(z)
	if c == '+':
		q[z - 1] += 1
		if q[z - 1] == 2:
			co2 += 1
		if q[z - 1] == 4:
			co2 -= 1
			co4 += 1
		if q[z - 1] == 6:
			co4 -= 1
			co6 += 1
		if q[z - 1] == 8:
			co6 -= 1
			co8 += 1
	else:
		if q[z - 1] == 2:
			co2 -= 1
		if q[z - 1] == 4:
			co2 += 1
			co4 -= 1
		if q[z - 1] == 6:
			co4 += 1
			co6 -= 1
		if q[z - 1] == 8:
			co6 += 1
			co8 -= 1
		q[z - 1] -= 1
	if co8 or (co6 and (co6 >= 2 or co4 or co2)) or (co4 and (co4 >= 2 or co2 >= 2)):
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	q = int(input())
	que = [tuple(input().split()) for i in range(q)]
	duplicated = set([])
	pair = 0
	count = [0] * (10 ** 5 + 10)
	for v in a:
		count[v] += 1
	for i in range(1, 10 ** 5 + 10):
		pair += count[i] // 2
		if count[i] >= 4:
			duplicated.add(i)
	for i in range(q):
		(command, value) = que[i]
		value = int(value)
		if command == '+':
			if count[value] % 2 == 0:
				count[value] += 1
			else:
				count[value] += 1
				pair += 1
				if count[value] >= 4:
					duplicated.add(value)
		elif count[value] % 2 == 0:
			pair -= 1
			count[value] -= 1
			if count[value] == 3:
				duplicated.remove(value)
		else:
			count[value] -= 1
		if duplicated and pair >= 4:
			print('YES')
		else:
			print('NO')
	return
main()


from collections import defaultdict
n = int(input())
li = list(map(int, input().split()))
q = int(input())
dd = defaultdict(lambda : 0)
co = defaultdict(lambda : 0)
for i in li:
	co[i] += 1
	x = co[i]
	dd[x] += 1
for _ in range(q):
	st = input()
	si = st[0]
	num = int(st[2:])
	if si == '+':
		co[num] += 1
		x = co[num]
		dd[x] += 1
	else:
		x = co[num]
		co[num] -= 1
		dd[x] -= 1
	if dd[4] >= 2:
		print('YES')
	elif dd[8] > 0:
		print('YES')
	elif dd[6] > 0 and dd[2] > 1:
		print('YES')
	elif dd[4] >= 1 and dd[2] >= 3:
		print('YES')
	else:
		print('NO')


numbers = [0] * 100001
mp = [0] * 5
n = int(input())
arr = list(map(int, input().split()))
for num in arr:
	numbers[num] += 1
for num in numbers:
	if num >= 4:
		mp[4] += num // 4
		mp[num % 4] += 1
	else:
		mp[num] += 1
for i in range(int(input())):
	(c, d) = map(str, input().split())
	d = int(d)
	x = numbers[d]
	numbers[d] = 0
	if x >= 4:
		mp[4] -= x // 4
		mp[x % 4] -= 1
	else:
		mp[x] -= 1
	if c == '+':
		numbers[d] = x + 1
	else:
		numbers[d] = x - 1
	x = numbers[d]
	if x >= 4:
		mp[4] += x // 4
		mp[x % 4] += 1
	else:
		mp[x] += 1
	if mp[4] >= 2 or (mp[4] > 0 and mp[2] + mp[3] >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
(*a,) = map(int, input().split())
from collections import defaultdict
d = defaultdict(int)
for ai in a:
	d[ai] += 1
cnts = {4: 0, 2: 0}
for k in d:
	cnts[4] += d[k] // 4
	cnts[2] += d[k] // 2
q = int(input())
for _ in range(q):
	(*qi,) = input().split()
	q1 = int(qi[1])
	if qi[0] == '+':
		d[q1] += 1
		if d[q1] % 4 == 0:
			cnts[4] += 1
		if d[q1] % 2 == 0:
			cnts[2] += 1
	else:
		d[q1] -= 1
		if d[q1] % 4 == 3:
			cnts[4] -= 1
		if d[q1] % 2 == 1:
			cnts[2] -= 1
	if cnts[4] > 0 and cnts[2] >= 4:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict
n = int(input())
lis = list(map(int, input().split()))
d = defaultdict(int)
x2 = 0
x4 = 0
x6 = 0
x8 = 0
for i in lis:
	d[i] += 1
	if d[i] == 8:
		x8 += 1
	elif d[i] == 6:
		x6 += 1
	elif d[i] == 4:
		x4 += 1
	elif d[i] == 2:
		x2 += 1
for _ in range(int(input())):
	(x, y) = map(str, input().split())
	i = int(y)
	if x == '+':
		d[i] += 1
		if d[i] == 8:
			x8 += 1
		elif d[i] == 6:
			x6 += 1
		elif d[i] == 4:
			x4 += 1
		elif d[i] == 2:
			x2 += 1
	else:
		if d[i] == 8:
			x8 -= 1
		elif d[i] == 6:
			x6 -= 1
		elif d[i] == 4:
			x4 -= 1
		elif d[i] == 2:
			x2 -= 1
		d[i] -= 1
	if x8 >= 1 or x4 >= 2 or (x6 >= 1 and x2 >= 2) or (x4 >= 1 and x2 >= 3):
		print('YES')
	else:
		print('NO')


def est(sz):
	s = list(map(len, sz))
	if s[4] > 0:
		return True
	if s[3] > 0 and (s[1] > 0 or s[2] > 0):
		return True
	if s[2] > 1:
		return True
	if s[2] and s[1] > 1:
		return True
	return False

def idx(count):
	if count >= 8:
		return 4
	return count // 2

def main():
	(n,) = map(int, input().split(' '))
	cnt = {}
	for _ in input().split(' '):
		a = int(_)
		if a in cnt:
			cnt[a] += 1
		else:
			cnt[a] = 1
	sz = [set(), set(), set(), set(), set()]
	for (a, count) in cnt.items():
		sz[idx(count)].add(a)
	pred = est(sz)
	for _ in range(int(input())):
		(op, a) = input().split(' ')
		a = int(a)
		count = cnt.get(a, 0)
		sz[idx(count)].discard(a)
		need_est = False
		if op == '-':
			count -= 1
			if pred == False:
				pass
			else:
				need_est = True
		if op == '+':
			count += 1
			if a in cnt:
				if pred == False:
					need_est = True
			else:
				pass
		sz[idx(count)].add(a)
		cnt[a] = count
		if need_est:
			pred = est(sz)
		print('YES' if pred else 'NO')
main()


import sys
import math
from collections import Counter, defaultdict
input = sys.stdin.readline
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
C = lambda : input().strip().split()
S = lambda : input()

def case():
	n = IN()
	a = LI()
	di = defaultdict(int)
	di = Counter(a)
	c = 0
	d = 0
	for i in di:
		t = di[i]
		if t >= 4:
			c += t // 4
			t = t % 4
		if t >= 2:
			d += 1
	for i in range(IN()):
		ans = 'NO'
		(p, q) = C()
		q = int(q)
		if p == '+':
			if di[q] % 4 == 3:
				d -= 1
				c += 1
			elif di[q] % 4 == 1:
				d += 1
			di[q] += 1
		else:
			if di[q] % 4 == 2:
				d -= 1
			elif di[q] % 4 == 0:
				c -= 1
				d += 1
			di[q] -= 1
		if c > 1 or (c and d > 1):
			ans = 'YES'
		print(ans)
for _ in range(1):
	case()


n = int(input())
arr = list(map(int, input().split()))
q = int(input())
num = [0] * 100000
num1 = [0] * 100000
num2 = [0] * 100000
s = 0
t = 0
for i in range(n):
	num[arr[i] - 1] += 1
for i in range(100000):
	if 0 == 0:
		if num[i] > 0 and num[i] % 2 == 0:
			s += num[i] // 2
		elif num[i] % 2 == 1:
			num1[i] = 1
			s += num[i] // 2
	if 0 == 0:
		if num[i] > 0 and num[i] % 4 == 0:
			t += num[i] // 4
		elif num[i] % 4 > 0:
			num2[i] = num[i] % 4
			t += num[i] // 4
for i in range(q):
	lis = list(map(str, input().split()))
	if lis[0] == '+':
		num[int(lis[1]) - 1] += 1
		if lis[0] == '+':
			if num1[int(lis[1]) - 1] == 0:
				num1[int(lis[1]) - 1] = 1
			elif num1[int(lis[1]) - 1] == 1:
				s += 1
				num1[int(lis[1]) - 1] = 0
		if lis[0] == '+':
			if num2[int(lis[1]) - 1] == 3:
				t += 1
				num2[int(lis[1]) - 1] = 0
			elif num2[int(lis[1]) - 1] < 3:
				num2[int(lis[1]) - 1] += 1
		if s >= 4 and t >= 1:
			print('YES')
		else:
			print('NO')
	else:
		num[int(lis[1]) - 1] -= 1
		if lis[0] == '-':
			if num1[int(lis[1]) - 1] == 0:
				num1[int(lis[1]) - 1] = 1
				s -= 1
			elif num1[int(lis[1]) - 1] == 1:
				num1[int(lis[1]) - 1] = 0
		if lis[0] == '-':
			if num2[int(lis[1]) - 1] == 0:
				t -= 1
				num2[int(lis[1]) - 1] = 3
			elif num2[int(lis[1]) - 1] > 0:
				num2[int(lis[1]) - 1] -= 1
		if s >= 4 and t >= 1:
			print('YES')
		else:
			print('NO')


import sys
input = lambda : sys.stdin.readline().rstrip()
n = int(input())
a = [int(i) for i in input().split()]
eight = {}
six = {}
four = {}
two = {}
one = {}
for i in a:
	if i not in eight:
		eight[i] = 1
	else:
		eight[i] += 1
st = set()
for i in eight:
	if eight[i] >= 8:
		continue
	elif eight[i] >= 6:
		six[i] = eight[i]
	elif eight[i] >= 4:
		four[i] = eight[i]
	elif eight[i] >= 2:
		two[i] = eight[i]
	else:
		one[i] = eight[i]
	st.add(i)
for i in st:
	del eight[i]
var = [eight, six, four, two, one]
chk = [8, 6, 4, 2, 1]
for i in range(int(input())):
	(x, y) = map(str, input().split())
	y = int(y)
	do = 1
	if x == '-':
		do *= -1
	flag = 0
	for j in range(5):
		if y in var[j]:
			flag = 1
			var[j][y] += do
			it = [var[j][y], j]
			for i in range(5):
				if it[0] >= chk[i]:
					var[i][y] = var[it[1]][y]
					if it[1] != i:
						del var[it[1]][y]
					break
		if flag == 1:
			break
	if flag == 0:
		if y not in var[-1]:
			var[-1][y] = do
		else:
			var[-1][y] += 1
	if len(var[0]) >= 1:
		print('YES')
	elif len(var[1]) >= 1 and len(var[1]) - 1 + len(var[2]) + len(var[3]) >= 1:
		print('YES')
	elif len(var[2]) > 1 or (len(var[2]) == 1 and len(var[3]) >= 2):
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.buffer.readline
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input().decode().rstrip('\n\r')
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	fse = 0
	tse = 0
	cnt = vector(int)
	n = inin()
	a = inar()
	for i in a:
		cnt[i] += 1
		if cnt[i] == 2:
			tse += 1
		if cnt[i] == 4:
			tse -= 1
			fse += 1
			cnt[i] -= 4
	q = inin()
	for _ in range(q):
		(p, q) = inst().split()
		q = int(q)
		if p == '+':
			cnt[q] += 1
			if cnt[q] == 2:
				tse += 1
			if cnt[q] == 4:
				tse -= 1
				fse += 1
				cnt[q] -= 4
		if p == '-':
			if cnt[q] == 0:
				tse += 1
				cnt[q] = 3
				fse -= 1
			else:
				cnt[q] -= 1
				if cnt[q] == 1:
					tse -= 1
		if tse >= 2 and fse >= 1 or fse >= 2:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout, setrecursionlimit

class Tail_Recursion_Optimization:

	def __init__(self, RECURSION_LIMIT, STACK_SIZE):
		setrecursionlimit(RECURSION_LIMIT)
		threading.stack_size(STACK_SIZE)
		return None

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		n = int(R())
		a = [int(x) for x in R().split()]
		check = {}
		cnt = {}
		for i in range(9):
			cnt[i] = 0
		for i in range(n):
			if a[i] not in check:
				check[a[i]] = 1
				cnt[1] += 1
			else:
				cnt[check[a[i]]] -= 1
				check[a[i]] += 1
				cnt[check[a[i]]] = 1 if check[a[i]] not in cnt else cnt[check[a[i]]] + 1
		for i in range(int(R())):
			(cmd, num) = [x for x in R().split()]
			num = int(num)
			if cmd == '+':
				n += 1
				if num not in check:
					check[num] = 1
					cnt[1] += 1
				else:
					cnt[check[num]] -= 1
					check[num] += 1
					cnt[check[num]] = 1 if check[num] not in cnt else cnt[check[num]] + 1
			elif cmd == '-':
				n -= 1
				cnt[check[num]] -= 1
				check[num] -= 1
				cnt[check[num]] += 1
			if n < 8:
				ans.append('NO')
			else:
				total = 0
				for j in range(1, 8):
					total += j * cnt[j]
				if total < n:
					ans.append('YES')
				else:
					rec = cnt[2] + cnt[3] + cnt[6] + cnt[7]
					squ = sum([cnt[j] for j in range(4, 8)])
					if rec >= 2 and squ or squ >= 2:
						ans.append('YES')
					else:
						ans.append('NO')
		W('\n'.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


from collections import defaultdict
t = int(input())
a = [int(x) for x in input().split()]
sqr = 0
rec = 0
sqrec = 0
d = defaultdict(lambda : 0)
for i in a:
	d[i] += 1
	if d[i] % 2 == 0:
		rec += 1
	if d[i] % 4 == 0:
		sqr += 1
for _ in range(int(input())):
	(exp, l) = input().split()
	l = int(l)
	if exp == '+':
		d[l] += 1
		if d[l] % 2 == 0:
			rec += 1
		if d[l] % 4 == 0:
			sqr += 1
	else:
		d[l] -= 1
		if d[l] % 2 != 0:
			rec -= 1
		if d[l] % 4 == 3:
			sqr -= 1
	if sqr >= 1 and rec >= 4:
		print('YES')
	else:
		print('NO')


import collections
(a, b, c, d) = (0, 0, 0, 0)
n = int(input())
maps = collections.defaultdict(int)
nums = list(map(int, input().split()))
for i in nums:
	maps[i] += 1
q = int(input())
for v in maps.values():
	if v == 2 or v == 3:
		a += 1
	if v == 4 or v == 5:
		b += 1
	if v == 6 or v == 7:
		c += 1
	if v >= 8:
		d += 1
for i in range(q):
	info = input().split()
	(flag, num) = (info[0], int(info[1]))
	if flag == '+':
		maps[num] += 1
		if maps[num] == 2:
			a += 1
		if maps[num] == 4:
			a -= 1
			b += 1
		if maps[num] == 6:
			b -= 1
			c += 1
		if maps[num] == 8:
			c -= 1
			d += 1
	else:
		if maps[num] == 2:
			a -= 1
		if maps[num] == 4:
			a += 1
			b -= 1
		if maps[num] == 6:
			b += 1
			c -= 1
		if maps[num] == 8:
			c += 1
			d -= 1
		maps[num] -= 1
	if d > 0:
		print('YES')
		continue
	if a >= 2 and b >= 1 or (a >= 1 and c >= 1) or (b >= 1 and c >= 1) or (b >= 2) or (c >= 2):
		print('YES')
	else:
		print('NO')


t = input()
vals = [[i, 0] for i in range(10 ** 5 + 1)]
twos = 0
fours = 0
for i in input().split():
	val = int(i)
	vals[val][1] += 1
	if vals[val][1] == 2:
		twos += 1
	if vals[val][1] == 4:
		twos -= 1
		fours += 1
	if vals[val][1] == 6 or vals[val][1] == 8:
		twos += 1
n = int(input())
for i in range(n):
	buf = input().split()
	val = int(buf[1])
	if buf[0] == '-':
		if vals[val][1] == 4:
			fours -= 1
			twos += 1
		elif vals[val][1] == 2:
			twos -= 1
		elif vals[val][1] == 6 or vals[val][1] == 8:
			twos -= 1
		vals[val][1] -= 1
	else:
		if vals[val][1] == 1:
			twos += 1
		elif vals[val][1] == 3:
			twos -= 1
			fours += 1
		elif vals[val][1] == 5 or vals[val][1] == 7:
			twos += 1
		vals[val][1] += 1
	if twos >= 2 and fours >= 1 or fours >= 2:
		print('YES')
	else:
		print('NO')


for t in range(1):
	n = int(input())
	planks = list(map(int, input().split()))
	freq = [0] * 10 ** 5
	for i in range(n):
		val = planks[i]
		freq[val - 1] += 1
	count2 = 0
	count4 = 0
	for i in range(len(freq)):
		val = freq[i]
		count4 += val // 4
		count2 += val // 2
	for i in range(int(input())):
		(x, y) = input().split()
		y = int(y)
		prev_value_c2 = freq[y - 1] // 2
		prev_value_c4 = freq[y - 1] // 4
		if x == '+':
			freq[y - 1] += 1
		else:
			freq[y - 1] -= 1
		curr_va_c2 = freq[y - 1] // 2
		curr_va_c4 = freq[y - 1] // 4
		count2 += curr_va_c2 - prev_value_c2
		count4 += curr_va_c4 - prev_value_c4
		if count2 >= 4 and count4 >= 1:
			print('YES')
		else:
			print('NO')


from collections import Counter
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
arr_count = Counter(arr)
two = 0
four = 0
for key in arr_count:
	two += arr_count[key] // 2
	four += arr_count[key] // 4
for _ in range(q):
	(stat, val) = input().split()
	val = int(val)
	if val in arr_count:
		two -= arr_count[val] // 2
		four -= arr_count[val] // 4
		if stat == '+':
			arr_count[val] += 1
		else:
			arr_count[val] -= 1
		two += arr_count[val] // 2
		four += arr_count[val] // 4
	else:
		arr_count[val] = 1
	if two >= 4 and four >= 1:
		print('YES')
	else:
		print('NO')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
n = int(data())
arr = l()
c = C(arr)
(t, f, s, e) = (0, 0, 0, 0)
for i in c.keys():
	if c[i] >= 8:
		e += 1
	elif c[i] >= 6:
		s += 1
	elif c[i] >= 4:
		f += 1
	elif c[i] >= 2:
		t += 1
for _ in range(int(data())):
	(char, value) = ssp()
	value = int(value)
	if char == '+':
		c[value] += 1
		if c[value] == 8:
			e += 1
			s -= 1
		if c[value] == 6:
			s += 1
			f -= 1
		if c[value] == 4:
			f += 1
			t -= 1
		if c[value] == 2:
			t += 1
	else:
		c[value] -= 1
		if c[value] == 7:
			e -= 1
			s += 1
		if c[value] == 5:
			s -= 1
			f += 1
		if c[value] == 3:
			f -= 1
			t += 1
		if c[value] == 1:
			t -= 1
	if e or s > 1 or f > 1:
		out('YES')
		continue
	if s == 1:
		if t or f:
			out('YES')
			continue
	if f == 1:
		if t >= 2:
			out('YES')
			continue
	out('NO')


from collections import Counter

def check_possible(four_no, two_no):
	if four_no >= 1 and two_no >= 2 or four_no >= 2:
		return 'YES'
	else:
		return 'NO'
n = int(input())
arr = list(map(int, input().split()))
cnt = Counter(arr)
four_no = 0
two_no = 0
for key in cnt:
	if cnt[key] >= 4:
		four_no += cnt[key] // 4
		if cnt[key] % 4 >= 2:
			two_no += 1
	elif cnt[key] >= 2:
		two_no += 1
status = check_possible(four_no, two_no)
query = int(input())
for i in range(query):
	val = list(map(str, input().split()))
	if val[0] == '+':
		cnt[int(val[1])] += 1
		if cnt[int(val[1])] % 4 == 0:
			four_no += 1
			two_no -= 1
		elif cnt[int(val[1])] % 2 == 0:
			two_no += 1
	elif val[0] == '-':
		cnt[int(val[1])] -= 1
		if cnt[int(val[1])] % 4 == 3:
			four_no -= 1
			two_no += 1
		elif cnt[int(val[1])] % 2 == 1:
			two_no -= 1
	status = check_possible(four_no, two_no)
	print(status)


from collections import defaultdict
con = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def main():
	N = int(input())
	A = getlist()
	D = defaultdict(int)
	squaremat = 0
	recmat = 0
	for i in range(N):
		val = A[i]
		D[val] += 1
		if D[val] % 4 == 2:
			recmat += 1
		elif D[val] % 4 == 0:
			recmat -= 1
			squaremat += 1
	Q = int(input())
	for i in range(Q):
		(sig, x) = list(input().split())
		x = int(x)
		if sig == '+':
			D[x] += 1
			if D[x] % 4 == 2:
				recmat += 1
			elif D[x] % 4 == 0:
				recmat -= 1
				squaremat += 1
			if squaremat >= 2 or (squaremat == 1 and recmat >= 2):
				print('YES')
			else:
				print('NO')
		else:
			if D[x] % 4 == 0:
				recmat += 1
				squaremat -= 1
			elif D[x] % 4 == 2:
				recmat -= 1
			D[x] -= 1
			if squaremat >= 2 or (squaremat == 1 and recmat >= 2):
				print('YES')
			else:
				print('NO')
main()


from math import *
from heapq import nlargest
import sys
from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
d = defaultdict(int)
for i in range(n):
	d[arr[i]] += 1
t = int(input())
arr = list(d.values())
c4 = 0
c2 = 0
for i in arr:
	c4 += i // 4
	c2 += i // 2
while t:
	t -= 1
	(a, b) = input().split()
	b = int(b)
	if a == '-':
		c2 += (d[b] - 1) // 2 - d[b] // 2
		c4 += (d[b] - 1) // 4 - d[b] // 4
		d[b] -= 1
	else:
		if b in d:
			d[b] += 1
		else:
			d[b] = 1
		c2 += d[b] // 2 - (d[b] - 1) // 2
		c4 += d[b] // 4 - (d[b] - 1) // 4
	if c4 >= 1 and c2 >= 4:
		print('YES')
	else:
		print('NO')


a = [0] * (10 ** 5 + 1)
n = int(input())
num2 = 0
num4 = 0
m = list(map(int, input().split()))
for i in range(n):
	a[m[i]] += 1
	if a[m[i]] % 4 == 0:
		num4 += 1
	if a[m[i]] % 2 == 0:
		num2 += 1
q = int(input())
for i in range(q):
	(op, x) = map(str, input().split())
	x = int(x)
	if op == '+':
		a[x] += 1
		if a[x] % 4 == 0:
			num4 += 1
		if a[x] % 2 == 0:
			num2 += 1
	if op == '-':
		a[x] -= 1
		if a[x] % 4 == 3:
			num4 -= 1
		if a[x] % 2 == 1:
			num2 -= 1
	if num4 >= 1 and num2 >= 4:
		print('YES')
	else:
		print('NO')


t = 1
while t:
	t = t - 1
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	cnt2 = 0
	cnt4 = 0
	for i in a:
		d[i] = d.get(i, 0) + 1
	for i in d.values():
		cnt2 += i // 2
		cnt4 += i // 4
	q = int(input())
	for i in range(q):
		(s, g) = input().split()
		g = int(g)
		if s == '+':
			pre = d.get(g, 0)
			if pre == 0:
				d[g] = 1
			else:
				d[g] += 1
			if pre % 2 and d[g] % 2 == 0:
				cnt2 += 1
			if pre % 4 and d[g] % 4 == 0:
				cnt4 += 1
		if s == '-':
			pre = d.get(g, 0)
			if pre == 0:
				d[g] = 0
			else:
				d[g] -= 1
			if pre % 2 == 0 and d[g] % 2 == 1:
				cnt2 -= 1
			if pre % 4 == 0 and d[g] % 4 == 3:
				cnt4 -= 1
		if cnt4 >= 2:
			print('YES')
		elif cnt4 == 1 and cnt2 >= 4:
			print('YES')
		else:
			print('NO')


n = int(input())
cnt = [0] * (10 ** 5 + 1)
cnt2 = 0
cnt4 = 0
for x in map(int, input().split()):
	cnt2 -= cnt[x] // 2
	cnt4 -= cnt[x] // 4
	cnt[x] += 1
	cnt2 += cnt[x] // 2
	cnt4 += cnt[x] // 4
for _ in range(int(input())):
	(sign, x) = input().split()
	x = int(x)
	cnt2 -= cnt[x] // 2
	cnt4 -= cnt[x] // 4
	if sign == '+':
		cnt[x] += 1
	else:
		cnt[x] -= 1
	cnt2 += cnt[x] // 2
	cnt4 += cnt[x] // 4
	if cnt4 >= 1 and cnt2 >= 4:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = {}
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
(sq, rc) = (0, 0)
for i in d:
	sq += d[i] // 4
	if d[i] % 4 >= 2:
		rc += 1
for i in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+' and y not in d:
		d[y] = 1
	else:
		sq -= d[y] // 4
		if d[y] % 4 >= 2:
			rc -= 1
		if x == '+':
			d[y] += 1
		else:
			d[y] -= 1
		sq += d[y] // 4
		if d[y] % 4 >= 2:
			rc += 1
	if sq >= 2:
		print('YES')
	elif sq == 1 and rc >= 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
n = int(input())
arr = list(map(int, stdin.readline().rstrip().split()))
ct = dict()
for k in arr:
	if k not in ct:
		ct[k] = 0
	ct[k] += 1
fr = 0
tw = 0
for i in ct:
	fr += ct[i] // 4
	tw += ct[i] % 4 // 2
t = int(input())
for i in range(t):
	p = input()
	if p[0] == '+':
		k = int(p[1:])
		if k not in ct:
			ct[k] = 0
		r = ct[k] // 4
		w = ct[k] % 4 // 2
		ct[k] += 1
		if ct[k] % 4 == 0:
			fr += 1
			tw -= 1
		elif ct[k] % 2 == 0:
			tw += 1
	else:
		k = int(p[1:])
		if ct[k] % 4 == 0:
			fr -= 1
			tw += 1
		elif ct[k] % 2 == 0:
			tw -= 1
		ct[k] -= 1
	if fr >= 2 or (fr >= 1 and tw >= 2):
		print('YES')
	else:
		print('NO')


t = int(input())
x = list(map(int, input().split()))
l = [0] * (10 ** 5 + 1)
cts = [0] * (10 ** 5 + 1)
for each in x:
	l[each] += 1
for each in l:
	cts[each] += 1
twos = cts[2] + cts[3]
fours = cts[4] + cts[5]
sixes = cts[6] + cts[7]
eights = sum(cts[8:])
for _ in range(int(input())):
	(s, n) = input().split()
	r = int(n)
	if s == '+':
		l[r] += 1
		if l[r] == 2:
			twos += 1
		elif l[r] == 4:
			fours += 1
			twos -= 1
		elif l[r] == 6:
			sixes += 1
			fours -= 1
		elif l[r] == 8:
			eights += 1
			sixes -= 1
	else:
		if l[r] == 2:
			twos -= 1
		elif l[r] == 4:
			fours -= 1
			twos += 1
		elif l[r] == 6:
			sixes -= 1
			fours += 1
		elif l[r] == 8:
			sixes += 1
			eights -= 1
		l[r] -= 1
	if (eights >= 1 or fours >= 2 or sixes >= 2) or (fours >= 1 and twos >= 2) or (sixes >= 1 and twos >= 1) or (sixes >= 1 and fours >= 1):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()
n = int(ri())
a = Ri()
q = int(ri())
(s4, s2, s1) = (0, 0, 0)
dic = {}
for i in a:
	if i not in dic:
		dic[i] = 1
		s1 += 1
	else:
		s4 -= dic[i] // 4
		s2 -= dic[i] % 4 // 2
		s1 -= dic[i] % 4 % 2 // 1
		dic[i] += 1
		s4 += dic[i] // 4
		s2 += dic[i] % 4 // 2
		s1 += dic[i] % 4 % 2 // 1
for _ in range(q):
	temp = ri().split()
	if temp[0] == '+':
		i = int(temp[1])
		if i not in dic:
			dic[i] = 1
			s1 += 1
		else:
			s4 -= dic[i] // 4
			s2 -= dic[i] % 4 // 2
			s1 -= dic[i] % 4 % 2 // 1
			dic[i] += 1
			s4 += dic[i] // 4
			s2 += dic[i] % 4 // 2
			s1 += dic[i] % 4 % 2 // 1
	else:
		i = int(temp[1])
		s4 -= dic[i] // 4
		s2 -= dic[i] % 4 // 2
		s1 -= dic[i] % 4 % 2 // 1
		dic[i] -= 1
		s4 += dic[i] // 4
		s2 += dic[i] % 4 // 2
		s1 += dic[i] % 4 % 2 // 1
		if dic[i] == 0:
			dic.pop(i)
	if s4 >= 2:
		YES()
	elif s4 == 1 and s2 >= 2:
		YES()
	else:
		NO()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		q = I()
		qa = [LS() for _ in range(q)]
		d = [0] * 6
		c = collections.defaultdict(int)
		for b in a:
			c[b] += 1
			if c[b] % 2 == 0 and c[b] < 9:
				d[c[b] // 2] += 1
				d[c[b] // 2 - 1] -= 1
		for (t, b) in qa:
			b = int(b)
			if t == '+':
				c[b] += 1
				if c[b] % 2 == 0 and c[b] < 9:
					d[c[b] // 2] += 1
					d[c[b] // 2 - 1] -= 1
			else:
				c[b] -= 1
				if c[b] % 2 == 1 and c[b] < 8:
					d[c[b] // 2] += 1
					d[c[b] // 2 + 1] -= 1
			t = d[4] * 2 + d[3] + d[2]
			u = d[3] + d[1]
			rr.append(YES(t > 1 or (t == 1 and u >= 2)))
	return JA(rr, '\n')
print(main())


mod = 998244353
n = int(input())
a = list(map(int, input().split()))
d = dict()
two = 0
four = 0
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
for i in d:
	two += d[i] // 2
	four += d[i] // 4
m = int(input())
for i in range(m):
	s = input().split()
	if s[0] == '+':
		l = int(s[1])
		if l in d:
			d[l] += 1
		else:
			d[l] = 1
		if d[l] % 2 == 0:
			two += 1
		if d[l] % 4 == 0:
			four += 1
	else:
		l = int(s[1])
		d[l] -= 1
		if d[l] % 2 == 1:
			two -= 1
		if d[l] % 4 == 3:
			four -= 1
	if four > 0 and two > 3:
		print('YES')
	else:
		print('NO')


n = int(input())
lengths = list(map(int, input().strip().split()))
events = int(input())
ele = [0] * (2 * pow(10, 5))
count = [0] * (2 * pow(10, 5))
for i in lengths:
	ele[i] += 1
	count[ele[i]] += 1
for _ in range(events):
	eventA = input().strip().split()
	sign = eventA[0]
	event = int(eventA[1])
	if sign == '+':
		ele[event] += 1
		count[ele[event]] += 1
	if sign == '-':
		count[ele[event]] -= 1
		ele[event] -= 1
	if count[8] >= 1 or count[4] >= 2 or (count[6] >= 1 and count[2] >= 2) or (count[4] >= 1 and count[2] >= 3):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if not True else 1):
	n = int(input())
	a = list(map(int, input().split()))
	count = [0] * (10 ** 5 + 69)
	(two, four, six, eight) = (0, 0, 0, 0)
	for i in a:
		count[i] += 1
		if count[i] == 2:
			two += 1
		if count[i] == 4:
			four += 1
		if count[i] == 6:
			six += 1
		if count[i] == 8:
			eight += 1
	for i in range(int(input())):
		(x, y) = input().split()
		y = int(y)
		if x == '+':
			count[y] += 1
		else:
			count[y] -= 1
		if x == '-' and count[y] == 3:
			four -= 1
		if x == '+' and count[y] == 4:
			four += 1
		if x == '-' and count[y] == 5:
			six -= 1
		if x == '+' and count[y] == 6:
			six += 1
		if x == '-' and count[y] == 1:
			two -= 1
		if x == '+' and count[y] == 2:
			two += 1
		if x == '-' and count[y] == 7:
			eight -= 1
		if x == '+' and count[y] == 8:
			eight += 1
		if eight or (six and two > 1) or four > 1 or (four and two > 2):
			print('YES')
		else:
			print('NO')


def solve():
	n = int(input())
	colv = [0 for i in range(8)]
	dct = {}
	for i in list(map(int, input().split())):
		if dct.get(i, False):
			if dct[i] < 8:
				colv[dct[i]] += 1
			if dct[i] < 8:
				colv[dct[i] - 1] -= 1
			dct[i] += 1
		else:
			dct[i] = 1
			colv[0] += 1
	for q in range(int(input())):
		(a, b) = input().split()
		b = int(b)
		if a == '+':
			if dct.get(b, False):
				if dct[b] < 8:
					colv[dct[b]] += 1
				if dct[b] < 8:
					colv[dct[b] - 1] -= 1
				dct[b] += 1
			else:
				dct[b] = 1
				colv[0] += 1
		else:
			dct[b] -= 1
			if dct[b] < 8:
				colv[dct[b]] -= 1
			if dct[b]:
				if dct[b] < 8:
					colv[dct[b] - 1] += 1
		s = 0
		m4 = False
		for i in range(1, 8):
			s += colv[i] * (i + i % 2)
			if i >= 3 and colv[i]:
				m4 = True
		if m4 and s >= 8:
			print('YES')
		else:
			print('NO')
for i in range(1):
	solve()


import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input()
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	fse = 0
	tse = 0
	cnt = vector(int)
	n = inin()
	a = inar()
	for i in a:
		cnt[i] += 1
		if cnt[i] == 2:
			tse += 1
		if cnt[i] == 4:
			tse -= 1
			fse += 1
			cnt[i] -= 4
	q = inin()
	for _ in range(q):
		(p, q) = inst().split()
		q = int(q)
		if p == '+':
			cnt[q] += 1
			if cnt[q] == 2:
				tse += 1
			if cnt[q] == 4:
				tse -= 1
				fse += 1
				cnt[q] -= 4
		if p == '-':
			if cnt[q] == 0:
				tse += 1
				cnt[q] = 3
				fse -= 1
			else:
				cnt[q] -= 1
				if cnt[q] == 1:
					tse -= 1
		if tse >= 2 and fse >= 1 or fse >= 2:
			print('YES')
		else:
			print('NO')


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	q = inp()
	w = [0] * 100010
	qq = 0
	ww = 0
	for i in a:
		w[i] = w[i] + 1
	for i in w:
		qq = qq + i // 4
		ww = ww + i // 2
	for i in range(q):
		(x, y) = map(str, input().split())
		y = int(y)
		qq = qq - w[y] // 4
		ww = ww - w[y] // 2
		if x == '+':
			w[y] = w[y] + 1
		else:
			w[y] = w[y] - 1
		qq = qq + w[y] // 4
		ww = ww + w[y] // 2
		if qq > 0 and ww > 3:
			print('YES')
		else:
			print('NO')

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


num = int(input())
dic = {}
sq = 0
rec = 0
for x in input().split():
	if int(x) in dic:
		dic[int(x)] += 1
		key = dic[int(x)]
		if key == 2:
			rec += 1
		elif key == 4:
			sq += 1
			rec -= 1
		elif key == 6:
			rec += 1
		elif key == 8:
			rec += 1
	else:
		dic[int(x)] = 1
eve = int(input())
temp = 0
for i in range(eve):
	(c, d) = input().split()
	if c == '+':
		if int(d) in dic:
			dic[int(d)] += 1
			key = dic[int(d)]
			if key == 2:
				rec += 1
			elif key == 4:
				sq += 1
				rec -= 1
			elif key == 6:
				rec += 1
			elif key == 8:
				rec += 1
		else:
			dic[int(d)] = 1
	else:
		key = dic[int(d)]
		if key == 2:
			rec -= 1
		elif key == 4:
			sq -= 1
			rec += 1
		elif key == 6:
			rec -= 1
		elif key == 8:
			rec -= 1
		dic[int(d)] -= 1
	if sq > 1:
		print('YES')
	elif sq > 0 and rec > 1:
		print('YES')
	else:
		print('NO')


import collections

def valid(count, al_2, al_4):
	has_4 = False
	num_2 = al_2 - len(al_4)
	for i in al_4:
		if not has_4 and count[i] >= 4:
			has_4 = True
			num_2 += (count[i] - 4) // 2
		else:
			num_2 += count[i] // 2
		if has_4 and num_2 >= 2:
			return True
	return False

def main():
	n = int(input())
	count = collections.Counter(list(map(int, input().split())))
	al_2 = 0
	al_4 = set()
	for i in count:
		if count[i] >= 2:
			al_2 += 1
		if count[i] >= 4:
			al_4.add(i)
	q = int(input())
	for _ in range(q):
		(sign, val) = input().split()
		val = int(val)
		if sign == '+':
			count[val] += 1
			if count[val] == 2:
				al_2 += 1
			if count[val] == 4:
				al_4.add(val)
		else:
			if count[val] == 2:
				al_2 -= 1
			if count[val] == 4:
				al_4.remove(val)
			count[val] -= 1
			if count[val] == 0:
				del count[val]
		if valid(count, al_2, al_4):
			print('YES')
		else:
			print('NO')
main()


from collections import defaultdict
import os
import sys
from io import BytesIO, IOBase
import math
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
n = int(input())
l = list([int(x) for x in input().split()])
d = defaultdict(int)
for i in l:
	d[i] += 1
q = int(input())
cnt = list(d.values())
c2 = 0
c4 = 0
for j in cnt:
	c4 += j // 4
	c2 += j // 2
for i in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		if b in d:
			d[b] += 1
		else:
			d[b] = 1
		if d[b] % 2 == 0:
			c2 += 1
		if d[b] % 4 == 0:
			c4 += 1
	else:
		d[b] -= 1
		if d[b] % 2 == 1:
			c2 -= 1
		if d[b] % 4 == 3:
			c4 -= 1
	if c4 > 0 and c2 > 3:
		print('YES')
	else:
		print('NO')


for _ in range(0, 1):
	n = int(input())
	liStr = input().split()
	arr = []
	for i in liStr:
		arr.append(int(i))
	di = {}
	for i in arr:
		di[i] = di.get(i, 0) + 1
	tp1 = 0
	tp2 = 0
	tp3 = 0
	tp4 = 0
	tp5 = 0
	for i in di:
		a = di[i]
		if a >= 8:
			tp1 += 1
		if a >= 6 and a <= 7:
			tp2 += 1
		if a >= 4 and a <= 5:
			tp3 += 1
		if a >= 2 and a <= 3:
			tp4 += 1
		if a < 2:
			tp5 += 1
	T = int(input())
	for _ in range(0, T):
		s = input()
		ch = s[0:1]
		x = int(s[2:])
		if ch == '+':
			oldFreq = di.get(x, 0)
			newFreq = oldFreq + 1
			di[x] = newFreq
			if newFreq == 2:
				tp5 -= 1
				tp4 += 1
			if newFreq == 4:
				tp4 -= 1
				tp3 += 1
			if newFreq == 6:
				tp3 -= 1
				tp2 += 1
			if newFreq == 8:
				tp2 -= 1
				tp1 += 1
		if ch == '-':
			oldFreq = di.get(x, 0)
			newFreq = oldFreq - 1
			di[x] = newFreq
			if newFreq == 1:
				tp4 -= 1
				tp5 += 1
			if newFreq == 3:
				tp3 -= 1
				tp4 += 1
			if newFreq == 5:
				tp2 -= 1
				tp3 += 1
			if newFreq == 7:
				tp1 -= 1
				tp2 += 1
		if tp1 > 0:
			print('YES')
			continue
		if tp2 > 0 and (tp3 > 0 or tp4 > 0):
			print('YES')
			continue
		if tp2 > 1:
			print('YES')
			continue
		if tp3 > 1:
			print('YES')
			continue
		if tp3 > 0 and tp4 > 1:
			print('YES')
			continue
		print('NO')


from collections import defaultdict
n = int(input())
av = list(map(int, input().split()))
d = defaultdict(int)
(sq, pair) = (0, 0)
for i in av:
	d[i] += 1
for i in d:
	sq += d[i] // 4
	pair += d[i] // 2
cases = int(input())
for i in range(cases):
	(c, r) = map(str, input().split())
	r = int(r)
	if c == '+':
		d[r] += 1
		if d[r] % 4 == 0:
			sq += 1
		if d[r] % 2 == 0:
			pair += 1
	else:
		temp = d[r]
		d[r] -= 1
		if temp % 4 == 0:
			sq -= 1
		if temp % 2 == 0:
			pair -= 1
	if sq >= 1 and pair - 2 >= 2:
		print('YES')
	else:
		print('NO')


def ans(a, b, n):
	length = len(a)
	counter = 0
	d = {}
	sq = 0
	rect = 0
	i1 = -1
	for i in a:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	for j in d:
		if d[j] >= 8:
			sq += 2
		elif d[j] >= 6:
			sq += 1
			rect += 1
		elif d[j] >= 4:
			sq += 1
		elif d[j] >= 2:
			rect += 1
	for i in range(n):
		x = b[counter]
		counter += 1
		if x > 0:
			if x not in d:
				d[x] = 1
			else:
				d[x] += 1
				if d[x] == 8:
					rect -= 1
					sq += 1
				elif d[x] == 6:
					rect += 1
				elif d[x] == 4:
					sq += 1
					rect -= 1
				elif d[x] == 2:
					rect += 1
			length += 1
		else:
			y = -x
			d[y] -= 1
			if d[y] == 7:
				sq -= 1
				rect += 1
			elif d[y] == 5:
				rect -= 1
			elif d[y] == 3:
				sq -= 1
				rect += 1
			elif d[y] == 1:
				rect -= 1
			length -= 1
		if length < 8:
			print('NO')
		elif sq >= 2:
			print('YES')
		elif sq == 1 and rect >= 2:
			print('YES')
		else:
			print('NO')
	return
m = int(input())
lis = input().split()
n = int(input())
a = []
for i in lis:
	a.append(int(i))
b = []
for j in range(n):
	x = input().split()
	if x[0] == '-':
		y = int(x[1]) * -1
	else:
		y = int(x[1])
	b.append(y)
ans(a, b, n)


from collections import Counter
import sys
input = sys.stdin.readline
sinput = lambda : sys.stdin.readline().rstrip()
n = int(input())
a = Counter(map(int, input().split()))
q = int(input())
(n2, n4, n6, n8) = (0, 0, 0, 0)
for i in a.values():
	if i >= 2:
		n2 += 1
	if i >= 4:
		n4 += 1
	if i >= 6:
		n6 += 1
	if i >= 8:
		n8 += 1
for _ in range(q):
	(s, k) = sinput().split()
	k = int(k)
	if s == '+':
		if k not in a:
			a[k] = 0
		a[k] += 1
		if a[k] == 2:
			n2 += 1
		elif a[k] == 4:
			n4 += 1
		elif a[k] == 6:
			n6 += 1
		elif a[k] == 8:
			n8 += 1
	else:
		a[k] -= 1
		if a[k] == 1:
			n2 -= 1
		elif a[k] == 3:
			n4 -= 1
		elif a[k] == 5:
			n6 -= 1
		elif a[k] == 7:
			n8 -= 1
	if n8 > 0 or n6 > 1 or (n6 == 1 and n2 > 1) or (n4 > 1) or (n4 == 1 and n2 > 2):
		print('YES')
	else:
		print('NO')


n = int(input())
lis = list(map(int, input().split()))
f = {}
ff = {}
for i in range(100000 + 5):
	f[i] = 0
	ff[i] = 0
for i in lis:
	if i not in f:
		f[i] = 1
		if f[i] not in ff:
			ff[f[i]] = 1
		else:
			ff[f[i]] += 1
	else:
		f[i] += 1
		if f[i] not in ff:
			ff[f[i]] = 1
		else:
			ff[f[i]] += 1
q = int(input())
flag = 0
for gamesense in range(q):
	(c, j) = input().split()
	j = int(j)
	if c == '+':
		f[j] += 1
		ff[f[j]] += 1
	else:
		ff[f[j]] -= 1
		f[j] -= 1
	if ff[4] > 1 or (ff[4] > 0 and ff[2] > 2) or (ff[6] > 0 and ff[2] > 1) or (ff[8] > 0):
		print('YES')
		flag = 1
		continue
	print('NO')


n = int(input())
a = list(map(int, input().split()))
d = {}
for i in a:
	d[i] = d.get(i, 0) + 1
four_s = 0
two_s = 0
for i in d:
	if d[i] >= 4:
		four_s += d[i] // 4
		two_s += d[i] % 4 // 2
	else:
		two_s += d[i] // 2
q = int(input())
for _ in range(q):
	(t, l) = input().split()
	l = int(l)
	if t == '+':
		d[l] = d.get(l, 0) + 1
		if d[l] % 4 == 0:
			two_s -= 1
			four_s += 1
		elif d[l] % 2 == 0:
			two_s += 1
	else:
		d[l] -= 1
		if (d[l] + 1) % 4 == 0:
			four_s -= 1
			two_s += 1
		elif (d[l] + 1) % 2 == 0:
			two_s -= 1
	if four_s >= 2 or (four_s >= 1 and two_s >= 2):
		print('YES')
	else:
		print('NO')


from collections import defaultdict
t = int(input())
l = list(map(int, input().split()))
q = int(input())
cnt = defaultdict()
(two, four, six, eight) = (0, 0, 0, 0)
for i in l:
	if i not in cnt:
		cnt[i] = 0
	cnt[i] += 1
for i in cnt.keys():
	four += cnt[i] // 4
	two += cnt[i] // 2
for _ in range(q):
	(c, i) = input().split()
	i = int(i)
	if c == '+':
		if i not in cnt:
			cnt[i] = 0
		cnt[i] += 1
		if cnt[i] % 4 == 0:
			four += 1
		if cnt[i] % 2 == 0:
			two += 1
	else:
		if cnt[i] % 4 == 0:
			four -= 1
		if cnt[i] % 2 == 0:
			two -= 1
		cnt[i] -= 1
	if four >= 1 and two >= 4:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

def mi():
	return map(int, input().split())

def lm():
	return list(map(int, input().split()))

def solve():
	n = nn()
	p = lm()
	moves = nn()
	all_planks = dd(int)
	four_planks = dd(int)
	two_planks = dd(int)
	for plank in p:
		all_planks[plank] += 1
		if all_planks[plank] >= 4:
			four_planks[plank] = all_planks[plank]
		if all_planks[plank] >= 2:
			two_planks[plank] = all_planks[plank]
	for _ in range(moves):
		(type, plank) = input().split()
		plank = int(plank)
		if type == '+':
			all_planks[plank] = all_planks[plank] + 1
			if all_planks[plank] >= 4:
				four_planks[plank] = all_planks[plank]
			if all_planks[plank] >= 2:
				two_planks[plank] = all_planks[plank]
		if type == '-':
			all_planks[plank] = all_planks[plank] - 1
			if all_planks[plank] >= 4:
				four_planks[plank] = all_planks[plank]
			if all_planks[plank] >= 2:
				two_planks[plank] = all_planks[plank]
			if all_planks[plank] == 3:
				del four_planks[plank]
			if all_planks[plank] == 1:
				del two_planks[plank]
		if len(four_planks) == 0:
			print('NO')
		elif len(four_planks) == 2:
			print('YES')
		else:
			for plank in four_planks:
				square = plank
			if four_planks[square] >= 8:
				print('YES')
			elif four_planks[square] >= 6:
				if len(two_planks) >= 2:
					print('YES')
				else:
					print('NO')
			elif len(two_planks) >= 3:
				print('YES')
			else:
				print('NO')
solve()


from sys import stdin
from collections import Counter
input = stdin.readline
n = int(input())
l = list(map(int, input().split()))
q = int(input())
count = Counter(l)
(eight, six, four, two) = [0] * 4
for num in count:
	if count[num] >= 8:
		eight += 1
	if count[num] >= 6:
		six += 1
	if count[num] >= 4:
		four += 1
	if count[num] >= 2:
		two += 1
for _ in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		count[y] += 1
		if count[y] == 8:
			eight += 1
		elif count[y] == 6:
			six += 1
		elif count[y] == 4:
			four += 1
		elif count[y] == 2:
			two += 1
	else:
		count[y] -= 1
		if count[y] == 7:
			eight -= 1
		elif count[y] == 5:
			six -= 1
		elif count[y] == 3:
			four -= 1
		elif count[y] == 1:
			two -= 1
	if eight >= 1 or (six >= 1 and two >= 2) or four >= 2 or (four >= 1 and two >= 3):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
from collections import Counter as cc
(n,) = I()
l = I()
(q,) = I()
d = cc(l)
ct1 = ct2 = 0
for i in d:
	x = d[i]
	ct1 += x // 4
	ct2 += x % 4 // 2
for i in range(q):
	(a, b) = input().strip().split()
	b = int(b)
	an = 'NO'
	x = d[b]
	if a == '+':
		d[b] += 1
		if x % 4 == 3:
			ct2 -= 1
			ct1 += 1
		elif x % 4 == 1:
			ct2 += 1
	else:
		d[b] -= 1
		if x % 4 == 2:
			ct2 -= 1
		elif x % 4 == 0:
			ct1 -= 1
			ct2 += 1
	if ct1 > 1 or (ct1 and ct2 > 1):
		an = 'YES'
	print(an)


from sys import stdout, stdin
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
v = [0] * 100001
for i in l:
	v[i] += 1
(sq, re) = (0, 0)
for i in v:
	if i > 0:
		t = i // 4
		sq += t
		r = i % 4
		t = r // 2
		re += t
q = int(input())
for i in range(q):
	s = input()
	m = s[0]
	a = int(s[2:])
	if m == '+':
		v[a] += 1
		if v[a] % 2 == 0:
			if v[a] % 4 == 0:
				re -= 1
				sq += 1
			else:
				re += 1
		if sq >= 2 or (sq == 1 and re >= 2):
			stdout.write('YES' + '\n')
		else:
			stdout.write('NO' + '\n')
	else:
		if v[a] == 0:
			raise Exception('KKS')
		if v[a] % 2 == 0:
			if v[a] % 4 == 0:
				sq -= 1
				re += 1
			else:
				re -= 1
		v[a] -= 1
		if sq >= 2 or (sq == 1 and re >= 2):
			stdout.write('YES' + '\n')
		else:
			stdout.write('NO' + '\n')


m = int(input())
a = list(map(int, input().split()))
n = int(input())
c = {}
for i in a:
	if i in c:
		c[i] += 1
	else:
		c[i] = 1
t = 0
p = 0
for (key, val) in c.items():
	t += val // 4
	val = val - val // 4 * 4
	p += val // 2
for i in range(n):
	b = list(input().split())
	if b[0] == '+':
		if int(b[1]) in c:
			c[int(b[1])] += 1
		else:
			c[int(b[1])] = 1
		if c[int(b[1])] % 4 == 0:
			t += 1
			p -= 1
		elif c[int(b[1])] % 2 == 0:
			p += 1
	else:
		if int(b[1]) in c:
			c[int(b[1])] -= 1
		if (c[int(b[1])] + 1) % 4 == 0:
			t -= 1
			p += 1
		elif (c[int(b[1])] + 1) % 2 == 0:
			p -= 1
	if t >= 2:
		print('YES')
	elif t == 1 and p >= 2:
		print('YES')
	else:
		print('NO')


import os
from collections import Counter
is_dev = 'vscode' in os.environ
if is_dev:
	inF = open('in.txt', 'r')
	outF = open('out.txt', 'w')

def ins(r):
	return list(map(int, r.split(' ')))

def input_():
	if is_dev:
		return inF.readline()[:-1]
	else:
		return input()

def print_(data):
	if is_dev:
		outF.write(str(data) + '\n')
	else:
		print(data)
n = int(input_())
planks = ins(input_())
planks = Counter(planks)
steps = int(input_())
selected_squares = {i for (i, j) in planks.items() if j >= 4}
selected_squares_rectangle = {i for (i, j) in planks.items() if j >= 6}
selected_rectangle = {i for (i, j) in planks.items() if 2 <= j < 4}
selected_squares_squares = {i for (i, j) in planks.items() if j >= 8}
for _ in range(steps):
	newPlankIn = input_().split()
	newPlankOp = 1 if newPlankIn[0] == '+' else -1
	newPlank = int(newPlankIn[1])
	if newPlankOp == 1:
		if newPlank in planks:
			if planks[newPlank] == 1:
				selected_rectangle.add(newPlank)
			elif planks[newPlank] == 3:
				selected_squares.add(newPlank)
				selected_rectangle.remove(newPlank)
			elif planks[newPlank] == 5:
				selected_squares_rectangle.add(newPlank)
			elif planks[newPlank] == 7:
				selected_squares_squares.add(newPlank)
	elif newPlank in planks:
		if planks[newPlank] == 2:
			selected_rectangle.remove(newPlank)
		elif planks[newPlank] == 4:
			selected_squares.remove(newPlank)
			selected_rectangle.add(newPlank)
		elif planks[newPlank] == 6:
			selected_squares_rectangle.remove(newPlank)
		if planks[newPlank] == 8:
			selected_squares_squares.remove(newPlank)
	planks[newPlank] += newPlankOp
	have_square = False
	have_rectangle = False
	if len(selected_squares_squares) >= 1:
		print_('YES')
		continue
	if len(selected_squares) >= 2:
		have_rectangle = True
	if len(selected_rectangle) >= 2:
		have_rectangle = True
	if len(selected_rectangle) == 1 and len(selected_squares_rectangle) >= 1:
		have_rectangle = True
	if len(selected_squares) >= 1:
		have_square = True
	possible = have_square and have_rectangle
	print_('YES' if possible else 'NO')
if is_dev:
	outF.close()

	def compare_file():
		print(open('out.txt', 'r').read() == open('outactual.txt', 'r').read())
	compare_file()


from sys import stdin, stdout
from math import gcd, sqrt
from collections import Counter
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
pr = lambda x: print(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
l = L()
d = Counter(l)
k = I()
c4 = 0
c2 = 0
c2before = 0
c2after = 0
for i in d.values():
	if i >= 2:
		c4 += i // 4
		c2 += i % 4 // 2
for _ in range(k):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		c4before = d[b] // 4
		c2before = d[b] % 4 // 2
		d[b] = d[b] + 1
		c4after = d[b] // 4
		c2after = d[b] % 4 // 2
		c2 += c2after - c2before
		c4 += c4after - c4before
	else:
		c4before = d[b] // 4
		c2before = d[b] % 4 // 2
		d[b] = d[b] - 1
		c4after = d[b] // 4
		c2after = d[b] % 4 // 2
		c2 += c2after - c2before
		c4 += c4after - c4before
	c = 0
	k = 0
	flag = 0
	if c4 >= 2 or (c4 == 1 and c2 >= 2):
		pr('YES')
	else:
		pr('NO')


from sys import stdin
input = stdin.readline
dicti = {}
n = int(input())
arr = list(map(int, input().split(' ')))
for i in range(n):
	dicti[arr[i]] = dicti.get(arr[i], 0) + 1
twothree = set()
fourfive = set()
sixseven = set()
eightover = set()
for i in dicti:
	if dicti[i] == 2 or dicti[i] == 3:
		twothree.add(i)
	elif dicti[i] == 4 or dicti[i] == 5:
		fourfive.add(i)
	elif dicti[i] == 6 or dicti[i] == 7:
		sixseven.add(i)
	elif dicti[i] >= 8:
		eightover.add(i)
for i in range(int(input())):
	(a, b) = input().strip().split(' ')
	b = int(b)
	if a == '+':
		dicti[b] = dicti.get(b, 0) + 1
		if dicti[b] == 2:
			twothree.add(b)
		elif dicti[b] == 4:
			twothree.remove(b)
			fourfive.add(b)
		elif dicti[b] == 6:
			fourfive.remove(b)
			sixseven.add(b)
		elif dicti[b] == 8:
			sixseven.remove(b)
			eightover.add(b)
	else:
		dicti[b] = dicti.get(b, 0) - 1
		if dicti[b] == 1:
			twothree.remove(b)
		elif dicti[b] == 3:
			fourfive.remove(b)
			twothree.add(b)
		elif dicti[b] == 5:
			sixseven.remove(b)
			fourfive.add(b)
		elif dicti[b] == 7:
			eightover.remove(b)
			sixseven.add(b)
	if len(eightover) > 0:
		print('YES')
	elif len(sixseven) > 0 and (len(sixseven) > 1 or len(fourfive) > 0 or len(twothree) > 0):
		print('YES')
	elif len(fourfive) > 1:
		print('YES')
	elif len(fourfive) > 0 and len(twothree) > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().strip().split()))
q = int(input())
count = {}
overTwo = 0
overFour = 0
overSix = 0
overEight = 0
for i in range(len(l)):
	if l[i] not in count:
		count[l[i]] = 1
	else:
		count[l[i]] += 1
for key in count.keys():
	if count[key] >= 8:
		overEight += 1
		overSix += 1
		overFour += 1
		overTwo += 1
	elif count[key] >= 6:
		overSix += 1
		overFour += 1
		overTwo += 1
	elif count[key] >= 4:
		overFour += 1
		overTwo += 1
	elif count[key] >= 2:
		overTwo += 1
for i in range(q):
	(a, b) = map(str, input().strip().split())
	b = int(b)
	if a == '+':
		if b not in count:
			count[b] = 0
		count[b] += 1
		if count[b] == 2:
			overTwo += 1
		if count[b] == 4:
			overFour += 1
		if count[b] == 6:
			overSix += 1
		if count[b] == 8:
			overEight += 1
	else:
		count[b] -= 1
		if count[b] == 1:
			overTwo -= 1
		if count[b] == 3:
			overFour -= 1
		if count[b] == 5:
			overSix -= 1
		if count[b] == 7:
			overEight -= 1
	if overEight > 0:
		print('YES')
	elif overSix > 0 and overTwo > 1:
		print('YES')
	elif overFour > 0 and overTwo > 2:
		print('YES')
	elif overFour > 1:
		print('YES')
	else:
		print('NO')


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial
from collections import defaultdict, Counter, OrderedDict, deque
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
I()
(ls, d) = (lint(), defaultdict(int))
for i in ls:
	d[i] += 1
(f, t, out) = (0, 0, [])
for i in d:
	(f, t) = (f + d[i] // 4, t + d[i] // 2)
for _ in range(I()):
	(op, x) = S().split()
	x = int(x)
	(f, t) = (f - d[x] // 4, t - d[x] // 2)
	if op == '+':
		d[x] += 1
	else:
		d[x] -= 1
	(f, t) = (f + d[x] // 4, t + d[x] // 2)
	out.append('YES') if f >= 1 and t >= 4 else out.append('NO')
sys.stdout.write('\n'.join(out))
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


production = True
import sys, math, collections, bisect, itertools, heapq, decimal, random, copy, re

def input(f=0, m=0):
	if m > 0:
		return [input(f) for i in range(m)]
	else:
		l = sys.stdin.readline()[:-1]
		if f >= 10:
			u = False
			f = int(str(f)[-1])
		else:
			u = True
		if f == 0:
			p = [l]
		elif f == 1:
			p = list(map(int, l.split()))
		elif f == 2:
			p = list(map(float, l.split()))
		elif f == 3:
			p = list(l)
		elif f == 4:
			p = list(map(int, list(l)))
		elif f == 5:
			p = l.split()
		return p if u else p[0]

def out(l, f=0, n=True):
	if f == 0:
		p = str(l)
	elif f == 1:
		p = ' '.join(map(str, l))
	elif f == 2:
		p = '\n'.join(map(str, l))
	elif f == 3:
		p = ''.join(map(str, l))
	print(p, end='\n' if n else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)

def mapl(i, f=0):
	if f == 0:
		return list(map(int, i))
	elif f == 1:
		return list(map(str, i))
	elif f == 2:
		return list(map(list, i))

def solve():
	n = input(11)
	a = input(1)
	q = input(11)
	p = []
	for i in range(q):
		(f, g) = input(5)
		p.append((ter(f == '+', 1, 0), int(g)))
	log(p)
	r = [0] * (10 ** 5 + 1)
	n8 = 0
	n6 = 0
	n4 = 0
	n2 = 0
	for i in a:
		r[i] += 1
		if r[i] == 8:
			n6 -= 1
			n8 += 1
		elif r[i] == 6:
			n4 -= 1
			n6 += 1
		elif r[i] == 4:
			n2 -= 1
			n4 += 1
		elif r[i] == 2:
			n2 += 1
	for (i, j) in p:
		if i:
			r[j] += 1
			if r[j] == 8:
				n6 -= 1
				n8 += 1
			elif r[j] == 6:
				n4 -= 1
				n6 += 1
			elif r[j] == 4:
				n2 -= 1
				n4 += 1
			elif r[j] == 2:
				n2 += 1
		else:
			r[j] -= 1
			if r[j] == 7:
				n6 += 1
				n8 -= 1
			elif r[j] == 5:
				n4 += 1
				n6 -= 1
			elif r[j] == 3:
				n2 += 1
				n4 -= 1
			elif r[j] == 1:
				n2 -= 1
		log(r[:10])
		log(n8, n6, n4, n2)
		s1 = n4 or n6 or n8
		s2 = n2 > 1 or n4 > 1 or n6 > 1 or n8 or (n2 and n6) or (n4 and n6)
		out(ter(s1 and s2, 'YES', 'NO'))
	log()
	return
solve()


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192
sys.setrecursionlimit(300000)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
n = int(input())
l = list(map(int, input().split()))
q = int(input())
d = defaultdict(int)
for i in range(n):
	d[l[i]] += 1
dual = 0
quad = 0
for i in d:
	quad += d[i] // 4
	dual += d[i] // 2
for i in range(q):
	n = input()
	e1 = int(n[2:])
	if n[0] == '+':
		d[e1] += 1
		if d[e1] % 2 == 0:
			dual += 1
		if d[e1] % 4 == 0:
			quad += 1
	else:
		d[e1] -= 1
		if d[e1] % 2 == 1:
			dual -= 1
		if d[e1] % 4 == 3:
			quad -= 1
	if quad >= 1 and dual > 3:
		print('YES')
	else:
		print('NO')


n = int(input())
num = [0 for i in range(100001)]
ar = list(map(int, input().split()))
for i in ar:
	num[i] += 1
(et, sx, fr, to) = (0, 0, 0, 0)
for i in range(100001):
	if num[i] >= 8:
		et += 1
	elif num[i] >= 6 and num[i] < 8:
		sx += 1
	elif num[i] >= 4 and num[i] < 6:
		fr += 1
	elif num[i] >= 2 and num[i] < 4:
		to += 1
for _ in range(int(input())):
	(s, r) = input().split()
	if s == '+':
		num[int(r)] += 1
		if num[int(r)] == 8:
			et += 1
			sx -= 1
		elif num[int(r)] == 6:
			sx += 1
			fr -= 1
		elif num[int(r)] == 4:
			fr += 1
			to -= 1
		elif num[int(r)] == 2:
			to += 1
	else:
		num[int(r)] -= 1
		if num[int(r)] == 7:
			et -= 1
			sx += 1
		elif num[int(r)] == 5:
			sx -= 1
			fr += 1
		elif num[int(r)] == 3:
			fr -= 1
			to += 1
		elif num[int(r)] == 1:
			to -= 1
	if et > 0:
		print('YES')
	elif sx > 1:
		print('YES')
	elif sx == 1:
		if fr > 1:
			print('YES')
		elif fr > 0 or to > 0:
			print('YES')
		else:
			print('NO')
	elif fr > 1:
		print('YES')
	elif fr == 1:
		if to > 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
b = set(a)
q = int(input())
d = [0 for i in range(10 ** 5 + 1)]
s1 = set()
s2 = set()
s3 = set()
s4 = set()
for i in a:
	d[i] += 1
	if d[i] == 8:
		s1.add(i)
		s2.remove(i)
	elif d[i] == 6:
		s2.add(i)
		s3.remove(i)
	elif d[i] == 4:
		s3.add(i)
		s4.remove(i)
	elif d[i] == 2:
		s4.add(i)
for i in range(q):
	k = input().split()
	n = int(k[1])
	if k[0] == '+':
		d[n] += 1
		if d[n] == 8:
			s1.add(n)
			s2.remove(n)
		elif d[n] == 6:
			s2.add(n)
			s3.remove(n)
		elif d[n] == 4:
			s3.add(n)
			s4.remove(n)
		elif d[n] == 2:
			s4.add(n)
	else:
		d[n] -= 1
		if d[n] == 7:
			s1.remove(n)
			s2.add(n)
		elif d[n] == 5:
			s2.remove(n)
			s3.add(n)
		elif d[n] == 3:
			s3.remove(n)
			s4.add(n)
		elif d[n] == 1:
			s4.remove(n)
	if len(s1) >= 1:
		print('YES')
	elif len(s2) >= 2:
		print('YES')
	elif len(s2) == 1:
		if len(s3) >= 1:
			print('YES')
		elif len(s4) >= 1:
			print('YES')
		else:
			print('NO')
	elif len(s3) >= 2:
		print('YES')
	elif len(s3) == 1:
		if len(s4) >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


def count(arr, aaa, bbb, ccc, ddd):
	for kk in arr:
		if kk >= 8:
			aaa += 1
			ddd += 1
			bbb += 1
			ccc += 1
		elif kk >= 6:
			ddd += 1
			bbb += 1
			ccc += 1
		elif kk >= 4:
			bbb += 1
			ccc += 1
		elif kk >= 2:
			ccc += 1
	return (aaa, bbb, ccc, ddd)
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
dic = dict(Counter(a))
(aa, bb, cc, dd) = count(dic.values(), 0, 0, 0, 0)
t = int(input())
while t:
	t -= 1
	y = input()
	(ads, x) = (y[0], int(y[1:]))
	if ads == '-':
		dic[x] -= 1
		if dic[x] == 7:
			aa -= 1
		elif dic[x] == 5:
			dd -= 1
		elif dic[x] == 3:
			bb -= 1
		elif dic[x] == 1:
			cc -= 1
	elif x in dic.keys():
		dic[x] += 1
		if dic[x] == 8:
			aa += 1
		elif dic[x] == 6:
			dd += 1
		elif dic[x] == 4:
			bb += 1
		elif dic[x] == 2:
			cc += 1
	else:
		dic[x] = 1
	if aa == 1 or (dd >= 1 and cc >= 2) or (bb >= 1 and cc >= 3) or (bb >= 2):
		print('YES')
	else:
		print('NO')


t = int(input())
a = input().split(' ')
a = list(map(int, a))
n = 2 * pow(10, 5)
lis = n * [0]
cnt = n * [0]
for ele in a:
	lis[ele] += 1
	cnt[lis[ele]] += 1
t2 = int(input())
for i in range(t2):
	c = input().split(' ')
	if c[0] == '+':
		v = int(c[1])
		lis[v] += 1
		cnt[lis[v]] += 1
	else:
		v = int(c[1])
		cnt[lis[v]] -= 1
		lis[v] -= 1
	if cnt[8] >= 1 or cnt[4] >= 2 or (cnt[6] >= 1 and cnt[2] >= 2) or (cnt[4] >= 1 and cnt[2] >= 3):
		print('YES')
	else:
		print('NO')


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop, heapify
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
from itertools import accumulate
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
n = val()
l = sorted(li())
cnt = Counter(l)
six = two = four = eight = 0
for i in cnt:
	if cnt[i] >= 8:
		eight += 1
	elif cnt[i] >= 6:
		six += 1
	elif cnt[i] > 3:
		four += 1
	elif cnt[i] > 1:
		two += 1
q = val()
for _ in range(q):
	s = st().split(' ')
	i = int(s[1])
	if s[0] == '+':
		cnt[i] += 1
		if cnt[i] == 8:
			eight += 1
			six -= 1
		elif cnt[i] == 6:
			six += 1
			four -= 1
		elif cnt[i] == 4:
			four += 1
			two -= 1
		elif cnt[i] == 2:
			two += 1
	else:
		cnt[i] -= 1
		if cnt[i] == 7:
			eight -= 1
			six += 1
		elif cnt[i] == 5:
			six -= 1
			four += 1
		elif cnt[i] == 3:
			four -= 1
			two += 1
		elif cnt[i] == 1:
			two -= 1
	curr = 0
	if eight or six >= 2 or (six and (two or four)) or (four >= 2) or (four and two >= 2):
		curr = 1
	print('YES' if curr else 'NO')


import math
import collections
from sys import stdin, stdout, setrecursionlimit
from bisect import bisect_left as bsl
from bisect import bisect_right as bsr
import heapq as hq
setrecursionlimit(2 ** 20)
t = 1
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().rstrip().split()))
	d = {}
	for i in a:
		if i not in d:
			d[i] = 0
		d[i] += 1
	cnt4 = 0
	cnt2 = 0
	for i in d:
		cnt4 += d[i] // 4
		rem = d[i] - 4 * (d[i] // 4)
		cnt2 += rem // 2
	l = []
	q = int(stdin.readline())
	for i in range(q):
		tmp = stdin.readline().strip('\n')
		t1 = tmp[0]
		t2 = int(tmp[2:])
		if t1 == '+':
			if t2 not in d:
				d[t2] = 0
			d[t2] += 1
			if d[t2] % 4 == 0:
				cnt2 -= 1
				cnt4 += 1
			elif d[t2] % 2 == 0:
				cnt2 += 1
		else:
			if d[t2] % 4 == 0:
				cnt2 += 1
				cnt4 -= 1
			elif d[t2] % 2 == 0:
				cnt2 -= 1
			d[t2] -= 1
		if cnt4 >= 2 or (cnt2 >= 2 and cnt4 >= 1):
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INLS():
	return [_ for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def MOD():
	return pow(10, 9) + 7

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
from collections import Counter
n = INI()
X = INL()
D = Counter(X)
x = 0
y = 0
for _ in D:
	x += int(D[_]) // 4
	y += int(D[_]) // 2
for _ in range(INI()):
	u = INLS()
	x -= D[int(u[1])] // 4
	y -= D[int(u[1])] // 2
	if u[0] == '+':
		D[int(u[1])] += 1
	else:
		D[int(u[1])] -= 1
	x += D[int(u[1])] // 4
	y += D[int(u[1])] // 2
	if 1 < x or (x == 1 and y > 3):
		OPS('YES')
	else:
		OPS('NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * (10 ** 5 + 5)
cnt4 = 0
cnt2 = 0
for i in range(n):
	b[a[i]] += 1
for elem in b:
	cnt4 += elem // 4
	cnt2 += elem // 2
for i in range(q):
	s = input().split()
	x = int(s[1])
	cnt4 -= b[x] // 4
	cnt2 -= b[x] // 2
	if s[0] == '+':
		b[x] += 1
	else:
		b[x] -= 1
	cnt4 += b[x] // 4
	cnt2 += b[x] // 2
	if cnt4 > 0:
		cnt = cnt2 - 2
		if cnt >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from collections import defaultdict
input()
dict = defaultdict(int)
rect = 0
sqr = 0
for item in input().split():
	dict[item] += 1
	if dict[item] % 4 == 0:
		sqr += 1
		rect -= 1
	elif dict[item] % 4 == 2:
		rect += 1
for _ in range(int(input())):
	(a, b) = input().split()
	sqr -= dict[b] // 4
	if dict[b] % 4 > 1:
		rect -= 1
	if a == '+':
		dict[b] += 1
	else:
		dict[b] -= 1
	sqr += dict[b] // 4
	if dict[b] % 4 > 1:
		rect += 1
	if sqr > 1:
		print('YES')
	elif sqr > 0 and rect > 1:
		print('YES')
	else:
		print('NO')


from collections import Counter as C
twos = 0
fours = 0
n = int(input())
arr = [int(x) for x in input().split()]
cnt = C(arr)
for f in cnt.values():
	_4 = f // 4
	_2 = 1 if f - _4 * 4 >= 2 else 0
	twos += _2
	fours += _4
q = int(input())
for _ in range(q):
	ss = input().split()
	(sign, x) = (ss[0], int(ss[1]))
	if sign == '+':
		cnt[x] += 1
		if cnt[x] % 4 == 0:
			twos -= 1
			fours += 1
		elif cnt[x] % 2 == 0:
			twos += 1
	else:
		if cnt[x] % 4 == 0:
			twos += 1
			fours -= 1
		elif cnt[x] % 2 == 0:
			twos -= 1
		cnt[x] -= 1
	if twos >= 2 and fours >= 1:
		print('YES')
	elif fours >= 2:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
n = int(input())
(*a,) = map(int, input().split())
cnt = [0] * 100001
t = f = 0
for i in a:
	if cnt[i] & 1:
		t += 1
	if cnt[i] & 3 == 3:
		f += 1
	cnt[i] += 1
for _ in range(int(input())):
	cmd = input().split()
	x = int(cmd[1])
	if cmd[0] == '+':
		if cnt[x] & 1:
			t += 1
		if cnt[x] & 3 == 3:
			f += 1
		cnt[x] += 1
	else:
		if not cnt[x] & 1:
			t -= 1
		if not cnt[x] & 3:
			f -= 1
		cnt[x] -= 1
	print('YES' if f and t > 3 else 'NO')


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')
from collections import Counter

def main():
	n = ri()
	a = ria()
	c = Counter(a)
	d4 = {k: v for (k, v) in c.items() if v >= 4}
	d2 = {k: v for (k, v) in c.items() if 2 <= v < 4}
	q = ri()
	for i in range(q):
		(op, x) = rs().split()
		x = int(x)
		if x not in c:
			c[x] = 0
		if op == '+':
			c[x] += 1
		else:
			c[x] -= 1
		if c[x] >= 4:
			d4[x] = c[x]
			if x in d2:
				del d2[x]
		if c[x] >= 2 and c[x] < 4:
			d2[x] = c[x]
		if c[x] < 4 and x in d4:
			del d4[x]
			d2[x] = c[x]
		if c[x] < 2 and x in d2:
			del d2[x]
		first_key = lambda d: next(iter(d))
		if len(d4) > 1 or (len(d4) == 1 and len(d2) > 1) or (len(d4) == 1 and d4[first_key(d4)] >= 8) or (len(d4) == 1 and d4[first_key(d4)] >= 6 and (len(d2) > 0)):
			ws('YES')
		else:
			ws('NO')
main()


n = int(input())
a = list(map(int, input().split()))
q = int(input())
cnt8 = 0
cnt6 = 0
cnt4 = 0
cnt2 = 0
d = dict()
for i in a:
	d[i] = d.get(i, 0) + 1
for i in d.values():
	if i >= 8:
		cnt8 += 1
	if i >= 6:
		cnt6 += 1
	if i >= 4:
		cnt4 += 1
	if i >= 2:
		cnt2 += 1
for i in range(q):
	(t, val) = input().split()
	val = int(val)
	d[val] = d.get(val, 0)
	if d[val] >= 8:
		cnt8 -= 1
	if d[val] >= 6:
		cnt6 -= 1
	if d[val] >= 4:
		cnt4 -= 1
	if d[val] >= 2:
		cnt2 -= 1
	if t == '+':
		d[val] += 1
	else:
		d[val] -= 1
	if d[val] >= 8:
		cnt8 += 1
	if d[val] >= 6:
		cnt6 += 1
	if d[val] >= 4:
		cnt4 += 1
	if d[val] >= 2:
		cnt2 += 1
	if cnt8 >= 1:
		print('YES')
	elif cnt6 > 1 or (cnt6 == 1 and cnt2 >= 2):
		print('YES')
	elif cnt4 > 1 or (cnt4 == 1 and cnt2 >= 3):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
query = int(input())
cnt2 = 0
cnt4 = 0
ans = [0] * (10 ** 5 + 1)
for i in arr:
	ans[i] += 1
for i in ans:
	cnt2 += i // 2
	cnt4 += i // 4
for x in range(query):
	(sign, val) = input().split()
	cnt2 -= ans[int(val)] // 2
	cnt4 -= ans[int(val)] // 4
	if sign == '+':
		ans[int(val)] += 1
	else:
		ans[int(val)] -= 1
	cnt2 += ans[int(val)] // 2
	cnt4 += ans[int(val)] // 4
	if cnt2 >= 4 and cnt4 > 0:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().rstrip()

def input_split():
	return [int(i) for i in input().split()]
n = int(input())
answers = []
arr = input_split()
q = int(input())
counts = {a: 0 for a in arr}
for a in arr:
	counts[a] += 1
above_4 = set()
above_2 = set()
for k in counts:
	if counts[k] >= 4:
		above_4.add(k)
		above_2.add(k)
	elif counts[k] >= 2:
		above_2.add(k)
	else:
		pass
for _ in range(q):
	(sym, length) = input().split()
	length = int(length)
	if sym == '+':
		if length not in counts:
			counts[length] = 1
		else:
			counts[length] += 1
			if counts[length] == 2:
				above_2.add(length)
			elif counts[length] == 4:
				above_4.add(length)
			else:
				pass
	else:
		counts[length] -= 1
		if counts[length] == 1:
			above_2.discard(length)
			above_4.discard(length)
		elif counts[length] == 3:
			above_4.discard(length)
		else:
			pass
	ans = None
	if len(above_4) >= 1 and len(above_2) >= 3:
		ans = 'YES'
	elif len(above_4) == 1:
		amt = counts[list(above_4)[0]]
		if amt >= 8 and len(above_2) == 1:
			ans = 'YES'
		elif amt >= 6 and len(above_2) == 2:
			ans = 'YES'
	elif len(above_4) == 2:
		ans = 'YES'
	if ans is None:
		ans = 'NO'
	answers.append(ans)
print(*answers, sep='\n')


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = 1
while t:
	t -= 1
	v = int(fastinput())
	d = dict()
	cnt = [0] * 9
	for i in fastinput().split():
		if i in d:
			d[i] += 1
			if d[i] <= 8:
				cnt[d[i] - 1] -= 1
				cnt[d[i]] += 1
		else:
			d[i] = 1
			cnt[1] += 1
	q = int(fastinput())
	while q:
		q -= 1
		x = list((i for i in fastinput().split()))
		n = x[1]
		if x[0] == '-':
			d[n] -= 1
			if d[n] < 8:
				cnt[d[n]] += 1
				cnt[d[n] + 1] -= 1
		elif n in d:
			d[n] += 1
			if d[n] <= 8:
				cnt[d[n] - 1] -= 1
				cnt[d[n]] += 1
		else:
			d[n] = 1
			cnt[1] += 1
		if cnt[8] >= 1:
			print('YES')
		elif cnt[4] + cnt[5] + cnt[6] + cnt[7] >= 2:
			print('YES')
		elif cnt[6] + cnt[7] == 1 and cnt[2] + cnt[3] + cnt[4] + cnt[5] >= 1:
			print('YES')
		elif cnt[4] + cnt[5] >= 1 and cnt[2] + cnt[3] >= 2:
			print('YES')
		else:
			print('NO')


from sys import stdin
input = stdin.readline
n = int(input())
(*a,) = map(int, input().split())
cnt = [0] * 100001
k = 0
m = 0
for i in a:
	cnt[i] += 1
	if cnt[i] % 4 == 0:
		k += 1
	if cnt[i] % 2 == 0:
		m += 1
q = int(input())
for i in range(q):
	(cmd, x) = input().split()
	x = int(x)
	if cmd == '+':
		cnt[x] += 1
		if cnt[x] % 4 == 0:
			k += 1
		if cnt[x] % 2 == 0:
			m += 1
		n += 1
	else:
		if cnt[x] % 4 == 0:
			k -= 1
		if cnt[x] % 2 == 0:
			m -= 1
		cnt[x] -= 1
		n -= 1
	if k > 1 or (k == 1 and m > 3):
		print('YES')
	else:
		print('NO')


import sys
import math
ii = lambda : int(sys.stdin.buffer.readline().rstrip())
il = lambda : list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda : list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]
iss = lambda : sys.stdin.buffer.readline().decode().rstrip()
sl = lambda : list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]
n = ii()
a = il()
q = ii()
cnt = [0] * (10 ** 5 + 1)
cnt_246 = [0, 0, 0, 0]
lis = [2, 4, 6, 8]
for i in range(n):
	cnt[a[i]] += 1
	if cnt[a[i]] in lis:
		cnt_246[lis.index(cnt[a[i]])] += 1
for qu in range(q):
	s = iss().split()
	if s[0] == '+':
		cnt[int(s[-1])] += 1
		if cnt[int(s[-1])] in lis:
			cnt_246[lis.index(cnt[int(s[-1])])] += 1
	else:
		cnt[int(s[-1])] -= 1
		if cnt[int(s[-1])] + 1 in lis:
			cnt_246[lis.index(cnt[int(s[-1])] + 1)] -= 1
	if cnt_246[3] >= 1 or cnt_246[2] >= 2 or (cnt_246[2] >= 1 and sum(cnt_246[:3]) >= 4) or (cnt_246[1] >= 2) or (cnt_246[1] == 1 and cnt_246[0] >= 3):
		print('YES')
	else:
		print('NO')


n = int(input())
a = [0] * 1000001
c = [0] * 1000001
for i in input().split():
	i = int(i)
	a[i] += 1
	c[a[i]] += 1
for _ in range(int(input())):
	j = input().split()
	if j[0] == '+':
		a[int(j[1])] += 1
		c[a[int(j[1])]] += 1
	elif j[0] == '-':
		c[a[int(j[1])]] -= 1
		a[int(j[1])] -= 1
	if (c[4] > 1 or c[8] >= 1) or (c[2] > 1 and c[6] >= 1) or (c[4] >= 1 and c[2] >= 3):
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
l = [0 for i in range(10 ** 5 + 1)]
cnt = [0 for i in range(10 ** 5 + 1)]
for i in a:
	i = int(i)
	l[i] += 1
	cnt[l[i]] += 1
for _ in range(q):
	(sign, num) = input().split()
	num = int(num)
	f = 0
	if sign == '+':
		l[num] += 1
		cnt[l[num]] += 1
	else:
		cnt[l[num]] -= 1
		l[num] -= 1
	if cnt[8] > 0:
		f = 1
	elif cnt[4] >= 2:
		f = 1
	elif cnt[4] > 0 and cnt[2] >= 3:
		f = 1
	elif cnt[6] > 0 and cnt[2] >= 2:
		f = 1
	if f:
		print('YES')
	else:
		print('NO')


import sys
import math
import collections
import heapq
import queue
import itertools
import functools
import operator
import time
readline = sys.stdin.readline
IPS = lambda : readline().rstrip()
IP = lambda : int(readline().rstrip())
MP = lambda : map(int, readline().split())
LS = lambda : list(map(int, readline().split()))
mod = 999999999

def solve():
	for _ in range(1):
		n = IP()
		arr = LS()
		q = IP()
		lst = [0 for i in range(100001)]
		(g8, g6, g4, g2) = (0, 0, 0, 0)
		for elem in arr:
			temp = lst[elem]
			if temp == 7:
				g8 += 1
				g6 -= 1
			if temp == 5:
				g6 += 1
				g4 -= 1
			if temp == 3:
				g4 += 1
				g2 -= 1
			if temp == 1:
				g2 += 1
			lst[elem] += 1
		while q != 0:
			q -= 1
			a = IPS()
			a = a.split()
			temp = lst[int(a[1])]
			if a[0] == '+':
				if temp == 7:
					g8 += 1
					g6 -= 1
				if temp == 5:
					g6 += 1
					g4 -= 1
				if temp == 3:
					g4 += 1
					g2 -= 1
				if temp == 1:
					g2 += 1
				lst[int(a[1])] += 1
			else:
				if temp == 8:
					g8 -= 1
					g6 += 1
				if temp == 6:
					g6 -= 1
					g4 += 1
				if temp == 4:
					g4 -= 1
					g2 += 1
				if temp == 2:
					g2 -= 1
				lst[int(a[1])] -= 1
			if g8 >= 1 or g6 >= 2 or (g6 >= 1 and g4 >= 1) or (g6 >= 1 and g2 >= 1) or (g4 >= 2) or (g4 >= 1 and g2 >= 2):
				print('YES')
			else:
				print('NO')
solve()


import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
mx = 10 ** 5
table = [0] * (mx + 1)
for x in a:
	table[x] += 1
two = set()
four = set()
six = set()
eight = set()
for i in range(1, mx + 1):
	if table[i] >= 8:
		eight.add(i)
	elif table[i] >= 6:
		six.add(i)
	elif table[i] >= 4:
		four.add(i)
	elif table[i] >= 2:
		two.add(i)
for _ in range(int(input())):
	(q, i) = input().split()
	i = int(i)
	if q == '+':
		table[i] += 1
		if table[i] == 8:
			eight.add(i)
			six.discard(i)
		elif table[i] == 6:
			six.add(i)
			four.discard(i)
		elif table[i] == 4:
			four.add(i)
			two.discard(i)
		elif table[i] == 2:
			two.add(i)
	else:
		table[i] -= 1
		if table[i] == 7:
			eight.discard(i)
			six.add(i)
		elif table[i] == 5:
			six.discard(i)
			four.add(i)
		elif table[i] == 3:
			four.discard(i)
			two.add(i)
		elif table[i] == 1:
			two.discard(i)
	if len(eight):
		print('YES')
	elif len(six) >= 2 or len(four) >= 2:
		print('YES')
	elif len(six) > 0 and (len(four) > 0 or len(two) > 0):
		print('YES')
	elif len(four) > 0 and len(two) >= 2:
		print('YES')
	else:
		print('NO')


import sys
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2 ** 60 - 1

def read_int():
	return int(buff_readline())

def read_int_n():
	return list(map(int, buff_readline().split()))

def read_float():
	return float(buff_readline())

def read_float_n():
	return list(map(float, buff_readline().split()))

def read_str():
	return readline().strip()

def read_str_n():
	return readline().strip().split()

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap
from collections import Counter

def slv(N, A, Q, KX):
	ac = Counter(A)
	f = set()
	t = set()
	for (k, v) in ac.items():
		if v >= 4:
			f.add(k)
		elif v >= 2:
			t.add(k)
	for (k, x) in KX:
		x = int(x)
		if k == '+':
			ac[x] += 1
		else:
			ac[x] -= 1
		if ac[x] >= 4:
			f.add(x)
			if x in t:
				t.remove(x)
		elif ac[x] >= 2:
			t.add(x)
			if x in f:
				f.remove(x)
		else:
			if x in t:
				t.remove(x)
			if f in t:
				f.remove(x)

		def g(f, t):
			for k in f:
				yield k
			for k in t:
				yield k
		if len(f) == 0:
			print('NO')
		else:
			n = 4
			for k in g(f, t):
				n -= ac[k] // 2
				if n <= 0:
					print('YES')
					break
			else:
				print('NO')

def main():
	N = read_int()
	A = read_int_n()
	Q = read_int()
	KX = [read_str_n() for _ in range(Q)]
	slv(N, A, Q, KX)
main()


np = int(input())
ps = list(map(int, input().strip().split()))
nq = int(input())
from collections import defaultdict
two_three = set()
four_plus = set()
cnts = defaultdict(int)
for i in ps:
	cnts[i] += 1
for k in cnts.keys():
	if cnts[k] >= 4:
		four_plus.add(k)
	if cnts[k] >= 2:
		two_three.add(k)
for i in range(nq):
	q = input().strip().split()
	if q[0] == '+':
		neww = int(q[1])
		cnts[neww] += 1
		if cnts[neww] == 2:
			two_three.add(neww)
		if cnts[neww] == 4:
			four_plus.add(neww)
	elif q[0] == '-':
		neww = int(q[1])
		cnts[neww] -= 1
		if cnts[neww] == 1:
			two_three.remove(neww)
		if cnts[neww] == 3:
			four_plus.remove(neww)
	if len(four_plus) >= 2 or (len(four_plus) == 1 and len(two_three) >= 3):
		print('YES')
	elif len(four_plus) == 1 and len(two_three) == 1:
		for i in two_three:
			if cnts[i] >= 8:
				print('YES')
			else:
				print('NO')
	elif len(four_plus) == 1 and len(two_three) == 2:
		(k1, k2) = sorted(two_three)
		if k1 in four_plus and cnts[k1] >= 6 and (cnts[k2] >= 2):
			print('YES')
		elif k2 in four_plus and cnts[k2] >= 6 and (cnts[k1] >= 2):
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input().split()[0])
arr = [0] * 100005
line = input().split()
for i in range(n):
	arr[int(line[i])] += 1
(eights, sixes, fours, twos) = (0, 0, 0, 0)
for i in range(100004):
	if arr[i] >= 8:
		eights += 1
	elif arr[i] >= 6:
		sixes += 1
	elif arr[i] >= 4:
		fours += 1
	elif arr[i] >= 2:
		twos += 1
numQueries = int(input().split()[0])
for i in range(numQueries):
	line = input().split()
	add = line[0]
	q = int(line[1])
	if add == '+':
		arr[q] += 1
		if arr[q] == 2:
			twos += 1
		elif arr[q] == 4:
			fours += 1
			twos -= 1
		elif arr[q] == 6:
			sixes += 1
			fours -= 1
		elif arr[q] == 8:
			eights += 1
			sixes -= 1
	if add == '-':
		arr[q] -= 1
		if arr[q] == 1:
			twos -= 1
		elif arr[q] == 3:
			fours -= 1
			twos += 1
		elif arr[q] == 5:
			sixes -= 1
			fours += 1
		elif arr[q] == 7:
			eights -= 1
			sixes += 1
	if fours + sixes + eights >= 2 or (fours >= 1 and twos >= 2) or (sixes >= 1 and twos >= 1) or (eights >= 1):
		print('YES')
	else:
		print('NO')


import collections
n = int(input())
num = list(map(int, input().split()))
k = collections.defaultdict(int)
for i in num:
	k[i] += 1
count = 0
two = 0
for i in k:
	count += k[i] // 4
	mod = k[i] % 4
	two += mod // 2
for i in range(int(input())):
	(o, v) = input().split()
	v = int(v)
	if o == '-':
		k[v] -= 1
		if k[v] % 4 == 3:
			count -= 1
			two += 1
		elif k[v] % 4 == 1:
			two -= 1
	else:
		k[v] += 1
		if k[v] % 4 == 0:
			two -= 1
			count += 1
		elif k[v] % 2 == 0:
			two += 1
	if count >= 2 or (count >= 1 and two >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
q = int(input())
have = [0] * 100010
for i in range(n):
	have[arr[i]] += 1
haveFour = 0
haveTwo = 0
for i in range(len(have)):
	haveFour += have[i] // 4
	haveTwo += have[i] % 4 // 2
for i in range(q):
	(a, b) = list(input().split())
	b = int(b)
	if a == '+':
		have[b] += 1
		if have[b] % 4 == 0:
			haveFour += 1
			haveTwo -= 1
		elif have[b] % 2 == 0:
			haveTwo += 1
	else:
		have[b] -= 1
		if have[b] % 4 == 3:
			haveFour -= 1
			haveTwo += 1
		elif have[b] % 2 == 1:
			haveTwo -= 1
	if haveFour >= 1 and haveTwo >= 2 or haveFour >= 2:
		print('YES')
	else:
		print('NO')


import math
from decimal import Decimal
import heapq
import copy
import heapq
from collections import deque
from collections import defaultdict

def na():
	n = int(input())
	b = [int(x) for x in input().split()]
	return (n, b)

def nab():
	n = int(input())
	b = [int(x) for x in input().split()]
	c = [int(x) for x in input().split()]
	return (n, b, c)

def dv():
	(n, m) = map(int, input().split())
	return (n, m)

def da():
	(n, m) = map(int, input().split())
	a = list(map(int, input().split()))
	return (n, m, a)

def dva():
	(n, m) = map(int, input().split())
	a = [int(x) for x in input().split()]
	b = [int(x) for x in input().split()]
	return (n, m, b)

def eratosthenes(n):
	sieve = list(range(n + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return sorted(set(sieve))

def lol(lst, k):
	k = k % len(lst)
	ret = [0] * len(lst)
	for i in range(len(lst)):
		if i + k < len(lst) and i + k >= 0:
			ret[i] = lst[i + k]
		if i + k >= len(lst):
			ret[i] = lst[i + k - len(lst)]
		if i + k < 0:
			ret[i] = lst[i + k + len(lst)]
	return ret

def nm():
	n = int(input())
	b = [int(x) for x in input().split()]
	m = int(input())
	c = [int(x) for x in input().split()]
	return (n, b, m, c)

def dvs():
	n = int(input())
	m = int(input())
	return (n, m)

def fact(n):
	tc = []
	ans = {}
	d = 2
	while d * d <= n:
		if n % d == 0:
			tc.append(d)
			n //= d
		else:
			d += 1
	if n > 1:
		tc.append(n)
	for i in tc:
		ans[i] = ans.get(i, 0) + 1
	return ans

def to_zero(n, s):
	lst = s[0]
	ans = []
	for i in range(n):
		if lst == s[i]:
			continue
		elif lst == '0':
			lst = '1'
			ans.append(i)
		else:
			lst = '0'
			ans.append(i)
	if lst == '1':
		ans.append(n)
	return ans
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
	d[i] += 1
kv = 0
kv2 = 0
for i in d:
	kv += d[i] // 4
	kv2 += d[i] // 2
for _ in range(int(input())):
	s = input().split()
	i = int(s[1])
	if s[0] == '+':
		if d[i] % 2 != 0:
			kv2 += 1
		if d[i] % 4 == 3:
			kv += 1
		d[i] += 1
		if kv == 0:
			print('NO')
		if kv == 1 and kv2 >= 4:
			print('YES')
		elif kv == 1 and kv2 < 4:
			print('NO')
		elif kv > 1:
			print('YES')
	else:
		if d[i] % 2 == 0:
			kv2 -= 1
		if d[i] % 4 == 0:
			kv -= 1
		d[i] -= 1
		if kv == 0:
			print('NO')
		if kv == 1 and kv2 >= 4:
			print('YES')
		elif kv == 1 and kv2 < 4:
			print('NO')
		elif kv > 1:
			print('YES')


from collections import Counter
n = int(input())
a = [int(i) for i in input().split()]
c = Counter(a)
b4 = 0
b2 = 0
for k in c.keys():
	if c[k] >= 4:
		b4 += c[k] // 4
	if c[k] >= 2:
		b2 += c[k] // 2
m = int(input())
for q in range(m):
	t = input().split()
	v = int(t[1])
	if t[0] == '+':
		if v in c.keys():
			c[v] += 1
			if c[v] % 2 == 0:
				b2 += 1
			if c[v] % 4 == 0:
				b4 += 1
		else:
			c[v] = 1
	else:
		c[v] -= 1
		if c[v] % 2 == 1:
			b2 -= 1
		if c[v] % 4 == 3:
			b4 -= 1
	if b4 >= 1 and (b4 >= 2 or b2 >= 4):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
q = int(input())
check = [0] * (10 ** 5 + 1)
sum2 = 0
sum4 = 0
for i in arr:
	sum2 -= check[i] // 2
	sum4 -= check[i] // 4
	check[i] += 1
	sum2 += check[i] // 2
	sum4 += check[i] // 4
for i in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		sum2 -= check[b] // 2
		sum4 -= check[b] // 4
		check[b] += 1
		sum2 += check[b] // 2
		sum4 += check[b] // 4
	else:
		sum2 -= check[b] // 2
		sum4 -= check[b] // 4
		check[b] -= 1
		sum2 += check[b] // 2
		sum4 += check[b] // 4
	if sum2 >= 4 and sum4 >= 1:
		print('YES')
	else:
		print('NO')


n = int(input())
a = map(int, input().split())
cnt = [0] * (10 ** 5 + 1)
c2 = 0
c4 = 0
for i in a:
	cnt[i] += 1
for i in cnt:
	c2 += i // 2
	c4 += i // 4
q = int(input())
for _ in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		cnt[y] += 1
		if cnt[y] % 4 == 0:
			c4 += 1
		if cnt[y] % 2 == 0:
			c2 += 1
	else:
		if cnt[y] % 4 == 0:
			c4 -= 1
		if cnt[y] % 2 == 0:
			c2 -= 1
		cnt[y] -= 1
	if c4 >= 2 or (c4 == 1 and c2 >= 4):
		print('YES')
	else:
		print('NO')


def check(fr, tw):
	if fr > 1:
		return 'YES'
	elif fr == 1:
		if tw > 1:
			return 'YES'
		else:
			return 'NO'
	else:
		return 'NO'
n = int(input())
a = list(map(int, input().split()))
sq = [0]
rect = [0, 0]
fr = 0
tw = 0
d = {}
for x in a:
	d[x] = d.get(x, [0, 0, 0])
	d[x][0] += 1
	d[x][1] = d[x][0] // 4
	d[x][2] = d[x][0] % 4 // 2
for x in d:
	fr += d[x][1]
	tw += d[x][2]
for q in range(int(input())):
	a = input().split()
	sn = a[0]
	x = int(a[1])
	if sn == '+':
		d[x] = d.get(x, [0, 0, 0])
		fr -= d[x][1]
		tw -= d[x][2]
		d[x][0] += 1
	else:
		fr -= d[x][1]
		tw -= d[x][2]
		d[x][0] -= 1
	d[x][1] = d[x][0] // 4
	d[x][2] = d[x][0] % 4 // 2
	fr += d[x][1]
	tw += d[x][2]
	print(check(fr, tw))


from collections import Counter
N = int(input())
List = [int(x) for x in input().split()]
Count = dict()
two = set()
four = set()
six = set()
eight = set()
for i in range(N):
	try:
		Count[List[i]] += 1
	except:
		Count[List[i]] = 1
	if Count[List[i]] >= 2:
		two.add(List[i])
	if Count[List[i]] >= 4:
		four.add(List[i])
	if Count[List[i]] >= 6:
		six.add(List[i])
	if Count[List[i]] >= 8:
		eight.add(List[i])
e = int(input())
for i in range(e):
	x = input()
	(sign, val) = (x[0], int(x[1:]))
	if sign == '+':
		try:
			Count[val] += 1
		except:
			Count[val] = 1
		if Count[val] >= 2:
			two.add(val)
		if Count[val] >= 4:
			four.add(val)
		if Count[val] >= 6:
			six.add(val)
		if Count[val] >= 8:
			eight.add(val)
	else:
		Count[val] -= 1
		if Count[val] == 7:
			eight.remove(val)
		if Count[val] == 5:
			six.remove(val)
		if Count[val] == 3:
			four.remove(val)
		if Count[val] == 1:
			two.remove(val)
	if len(four) > 1 or (len(four) >= 1 and len(two) >= 3) or (len(six) >= 1 and len(two) >= 2) or (len(eight) >= 1):
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
four = 0
two = 0
cnt = {}
for x in l:
	if x not in cnt:
		cnt[x] = 1
	else:
		cnt[x] += 1
for (k, v) in cnt.items():
	four += v // 4
	two += v % 4 // 2
q = int(input())
d = cnt.copy()
for i in range(q):
	(s, p) = input().split()
	p = int(p)
	if s == '+':
		if p not in d:
			cnt[p] = d[p] = 1
		else:
			cnt[p] = d[p]
			d[p] += 1
	else:
		cnt[p] = d[p]
		d[p] -= 1
	four += d[p] // 4 - cnt[p] // 4
	two += d[p] % 4 // 2 - cnt[p] % 4 // 2
	if four >= 2 or (four == 1 and two >= 2):
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout, setrecursionlimit
from math import gcd, ceil, sqrt
import heapq
from collections import Counter, deque
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
n = ii1()
arr = iia()
d = Counter(arr)
count4 = count2 = 0
for i in d:
	count4 += d[i] // 4
	count2 += d[i] % 4 // 2
q = ii1()
for i in range(q):
	(t, num) = isa()
	num = int(num)
	count4 -= d[num] // 4
	count2 -= d[num] % 4 // 2
	if t[0] == '+':
		d[num] += 1
		count2 += d[num] % 4 // 2
		count4 += d[num] // 4
	else:
		d[num] -= 1
		count2 += d[num] % 4 // 2
		count4 += d[num] // 4
	if count4 > 1:
		print('YES')
	elif count4 == 1 and count2 >= 2:
		print('YES')
	else:
		print('NO')


def solve(n, q, p, changes):
	count = {}
	for i in p:
		if i not in count:
			count[i] = 1
		else:
			count[i] += 1
	countP = [0] * 4
	for planks in count:
		if count[planks] >= 8:
			countP[3] += 1
		elif count[planks] >= 6:
			countP[2] += 1
		elif count[planks] >= 4:
			countP[1] += 1
		elif count[planks] >= 2:
			countP[0] += 1
	for event in changes:
		i = int(event[1:])
		if event[0] == '+':
			if i not in count:
				count[i] = 1
			else:
				count[i] += 1
			if count[i] == 8:
				countP[3] += 1
				countP[2] -= 1
			elif count[i] == 6:
				countP[2] += 1
				countP[1] -= 1
			elif count[i] == 4:
				countP[1] += 1
				countP[0] -= 1
			elif count[i] == 2:
				countP[0] += 1
		else:
			count[i] -= 1
			if count[i] == 7:
				countP[3] -= 1
				countP[2] += 1
			elif count[i] == 5:
				countP[2] -= 1
				countP[1] += 1
			elif count[i] == 3:
				countP[1] -= 1
				countP[0] += 1
			elif count[i] == 1:
				countP[0] -= 1
		if countP[3] >= 1 or countP[1] >= 2 or countP[2] >= 2 or (countP[1] == 1 and countP[0] >= 2) or (countP[2] >= 1 and (countP[0] >= 1 or countP[1] >= 1)):
			print('YES')
		else:
			print('NO')
n = int(input())
p = list(map(int, input().split()))
q = int(input())
changes = []
for i in range(q):
	changes.append(input())
solve(n, q, p, changes)


I = input
n = int(I())
a = list(map(int, I().split()))
f = dict()
s = dict()
d = dict()
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
for i in d:
	if d[i] >= 4:
		f[i] = d[i] // 4
		d[i] = d[i] % 4
		if d[i] >= 2:
			s[i] = 1
			d[i] = d[i] % 2
	elif 3 >= d[i] >= 2:
		s[i] = 1
		d[i] = d[i] % 2
a = []
for i in d:
	if d[i] == 0:
		a.append(i)
for i in a:
	d.pop(i)
for _ in range(int(I())):
	(sign, q) = I().split()
	i = int(q)
	if sign == '+':
		if i in d:
			if d[i] == 1:
				d[i] -= 1
				if i in s:
					s.pop(i)
					if i in f:
						f[i] += 1
					else:
						f[i] = 1
				else:
					s[i] = 1
			elif d[i] == 3:
				d[i] -= 3
				if i in f:
					f[i] += 1
				else:
					f[i] = 1
			elif d[i] == 0:
				d[i] += 1
		else:
			d[i] = 1
	elif sign == '-':
		if i in d:
			d[i] -= 1
			if d[i] == 2:
				d[i] = 0
				if i in s:
					s.pop(i)
					if i in f:
						f[i] += 1
					else:
						f[i] = 1
				else:
					s[i] = 1
		elif i in s:
			s.pop(i)
			d[i] = 1
		elif i in f:
			if f[i] > 1:
				f[i] -= 1
			else:
				f.pop(i)
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
			if i in s:
				s.pop(i)
				if i in f:
					f[i] += 1
				else:
					f[i] = 1
			else:
				s[i] = 1
	if d[i] == 0:
		d.pop(i)
	if len(f) >= 1 and (len(s) >= 2 or len(f) >= 2):
		print('YES')
	else:
		for i in f:
			if f[i] == 1:
				print('NO')
			else:
				print('YES')
			break
		if len(f) == 0:
			print('NO')


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))
from collections import Counter
n = itg()
counter = Counter(mpint())
sorted_list = SortedList(counter.values())
sorted_list.add(0)
sorted_list.add(0)

def judge():
	most = [sorted_list[-1], sorted_list[-2], sorted_list[-3]]
	if most[0] >= 8:
		return True
	if most[0] >= 6 and most[1] >= 2:
		return True
	return most[0] >= 4 and (most[1] >= 4 or (most[1] >= 2 and most[2] >= 2))
ans = judge()
for _ in range(itg()):
	(q, x) = inp().split()
	x = int(x)
	if q == '+':
		sorted_list.discard(counter[x])
		counter[x] += 1
		sorted_list.add(counter[x])
		if ans:
			print('YES')
		else:
			ans = judge()
			print('YES' if ans else 'NO')
	else:
		sorted_list.remove(counter[x])
		counter[x] -= 1
		sorted_list.add(counter[x])
		ans = judge()
		print('YES' if ans else 'NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
arr = [0] * (10 ** 5 + 1)
for i in a:
	arr[i] += 1
sum2 = 0
sum4 = 0
for i in arr:
	sum2 += i // 2
	sum4 += i // 4
for _ in range(q):
	(op, num) = input().split()
	num = int(num)
	sum2 -= arr[num] // 2
	sum4 -= arr[num] // 4
	if op == '-':
		arr[num] -= 1
	else:
		arr[num] += 1
	sum2 += arr[num] // 2
	sum4 += arr[num] // 4
	if sum4 >= 1 and sum2 >= 4:
		print('YES')
	else:
		print('NO')


from sys import stdin
maxn = 101010
n = int(stdin.readline())
cnt = [0] * maxn
has = [0] * 10
has[0] = maxn

def upd_has(pos, val):
	pos = min(pos, 8)
	for i in range(pos, -1, -1):
		has[i] += val
for i in map(int, stdin.readline().split()):
	upd_has(cnt[i], -1)
	cnt[i] += 1
	upd_has(cnt[i], 1)
q = int(stdin.readline())
for query in range(q):
	(ch, num) = stdin.readline().strip().split()
	num = int(num)
	sign = 1 if ch == '+' else -1
	upd_has(cnt[num], -1)
	cnt[num] += sign
	upd_has(cnt[num], 1)
	if has[8] > 0:
		print('YES')
		continue
	if has[6] > 0 and has[2] >= 2:
		print('YES')
		continue
	if has[4] > 0 and has[2] >= 3:
		print('YES')
		continue
	if has[4] >= 2:
		print('YES')
		continue
	print('NO')


n = int(input())
score = list(map(int, input().split(' ')))
res = []
coun = [0] * 100001
for i in score:
	coun[i] += 1
div2 = 0
div4 = 0
for i in coun:
	div2 += i // 2
	div4 += i // 4
for i in range(int(input())):
	s = input()
	new = int(s[2:])
	div2 -= coun[new] // 2
	div4 -= coun[new] // 4
	if s[0] == '+':
		coun[new] += 1
	else:
		coun[new] -= 1
	div2 += coun[new] // 2
	div4 += coun[new] // 4
	print('YES' if div4 >= 1 and div2 >= 4 else 'NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
count1 = 0
count2 = 0
d = {}
for x in range(n):
	try:
		d[a[x]] += 1
	except:
		d[a[x]] = 1
for x in d.keys():
	count1 += d[x] // 4
	count2 += d[x] % 4 // 2
for x in range(q):
	(b, c) = input().split()
	c = int(c)
	if b == '+':
		try:
			count1 -= d[c] // 4
			count2 -= d[c] % 4 // 2
			d[c] += 1
		except:
			d[c] = 1
	if b == '-':
		count1 -= d[c] // 4
		count2 -= d[c] % 4 // 2
		d[c] -= 1
	count1 += d[c] // 4
	count2 += d[c] % 4 // 2
	if count1 >= 2:
		print('YES')
	elif count1 == 1 and count2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
m = 10 ** 5
count = [0 for i in range(m + 1)]
for i in range(n):
	count[a[i]] += 1
(d2, d4, d6, d8) = (0, 0, 0, 0)
for i in range(m + 1):
	k = count[i]
	if k >= 8:
		d8 += 1
	elif k >= 6:
		d6 += 1
	elif k >= 4:
		d4 += 1
	elif k >= 2:
		d2 += 1
q = int(input())
for i in range(q):
	s = input()
	x = int(s[2:])
	if s[0] == '+':
		count[x] += 1
		k = count[x]
		if k == 2:
			d2 += 1
		elif k == 4:
			d2 -= 1
			d4 += 1
		elif k == 6:
			d4 -= 1
			d6 += 1
		elif k == 8:
			d6 -= 1
			d8 += 1
	else:
		count[x] -= 1
		k = count[x]
		if k == 1:
			d2 -= 1
		elif k == 3:
			d4 -= 1
			d2 += 1
		elif k == 5:
			d4 += 1
			d6 -= 1
		elif k == 7:
			d8 -= 1
			d6 += 1
	if d4 > 1 or d6 > 1 or d8 >= 1:
		print('YES')
	elif d6 == 1 and (d4 > 0 or d2 > 0):
		print('YES')
	elif d4 == 1 and d2 > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split(' ')))
count = [0] * int(100000.0 + 1)
fours = 0
twos = 0

def add(num):
	global fours, twos
	fours -= int(count[num] / 4)
	twos -= int(count[num] % 4 / 2)
	count[num] += 1
	fours += int(count[num] / 4)
	twos += int(count[num] % 4 / 2)

def remove(num):
	global fours, twos
	fours -= int(count[num] / 4)
	twos -= int(count[num] % 4 / 2)
	count[num] -= 1
	fours += int(count[num] / 4)
	twos += int(count[num] % 4 / 2)
for num in a:
	add(num)
q = int(input())
for i in range(0, q):
	(sign, num) = input().split(' ')
	num = int(num)
	if sign == '-':
		remove(num)
	else:
		add(num)
	if fours >= 1 and (fours - 1) * 2 + twos >= 2:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import threading
from collections import defaultdict
import heapq

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	q = int(input())
	cnt = [0] * (10 ** 5 + 1)
	for i in arr:
		cnt[i] += 1
	c2 = c4 = c6 = c8 = 0
	for i in range(10 ** 5 + 1):
		if cnt[i] >= 2 and cnt[i] < 4:
			c2 += 1
		if cnt[i] >= 4 and cnt[i] < 6:
			c4 += 1
		if cnt[i] >= 6 and cnt[i] < 8:
			c6 += 1
		if cnt[i] >= 8:
			c8 += 1
	for i in range(q):
		s = input().split()
		j = int(s[1])
		if s[0] == '-':
			if cnt[j] == 2:
				c2 -= 1
			if cnt[j] == 4:
				c4 -= 1
				c2 += 1
			if cnt[j] == 6:
				c6 -= 1
				c4 += 1
			if cnt[j] == 8:
				c8 -= 1
				c6 += 1
			cnt[j] -= 1
		else:
			cnt[j] += 1
			if cnt[j] == 2:
				c2 += 1
			if cnt[j] == 4:
				c4 += 1
				c2 -= 1
			if cnt[j] == 6:
				c6 += 1
				c4 -= 1
			if cnt[j] == 8:
				c8 += 1
				c6 -= 1
		if c8 >= 1 or (c6 >= 1 and (c2 >= 1 or c4 >= 1)) or (c4 >= 1 and c2 >= 2) or (c4 >= 2) or (c6 >= 2):
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(1):
	main()


n = int(input())
a = list(map(int, input().split()))
counts = {}
for el in a:
	if el in counts:
		counts[el] += 1
	else:
		counts[el] = 1
(g2, g4, g6, g8) = (0, 0, 0, 0)
for v in counts.values():
	if v >= 2:
		g2 += 1
	if v >= 4:
		g4 += 1
	if v >= 6:
		g6 += 1
	if v >= 8:
		g8 += 1
q = int(input())
while q:
	q -= 1
	(new, el) = input().split()
	el = int(el)
	if new == '+':
		if el in counts:
			counts[el] += 1
			v = counts[el]
			if v == 2:
				g2 += 1
			elif v == 4:
				g4 += 1
			elif v == 6:
				g6 += 1
			elif v == 8:
				g8 += 1
		else:
			counts[el] = 1
	else:
		counts[el] -= 1
		v = counts[el]
		if v == 1:
			g2 -= 1
		elif v == 3:
			g4 -= 1
		elif v == 5:
			g6 -= 1
		elif v == 7:
			g8 -= 1
	if g8 > 0:
		print('YES')
		continue
	if g6 > 0 and g2 >= 2:
		print('YES')
		continue
	if g4 > 0 and g2 >= 3:
		print('YES')
		continue
	if g4 >= 2:
		print('YES')
		continue
	print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
md = dict([])
sq = 0
rect = 0
for i in arr:
	if i in md:
		md[i] += 1
		if md[i] % 4 == 0:
			sq += 1
			rect += 1
		elif md[i] % 2 == 0:
			rect += 1
	else:
		md[i] = 1
q = int(input())
i = 0
for j in range(q):
	qu = input().split()
	if qu[0] == '+':
		i = int(qu[1])
		if i in md:
			md[i] += 1
			if md[i] % 4 == 0:
				sq += 1
				rect += 1
			elif md[i] % 2 == 0:
				rect += 1
		else:
			md[i] = 1
	else:
		i = int(qu[1])
		if md[i] % 4 == 0:
			sq -= 1
			rect -= 1
		elif md[i] % 2 == 0:
			rect -= 1
		md[i] -= 1
	if sq >= 2:
		print('YES')
	elif sq == 1 and rect - 2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
x = list(map(int, input().split()))
dic = {}
(count1, count2, count3, count4) = (0, 0, 0, 0)
for i in range(n):
	if not x[i] in dic:
		dic[x[i]] = 0
	dic[x[i]] += 1
for i in dic.keys():
	c = dic[i]
	if c >= 2:
		count1 += 1
	if c >= 4:
		count2 += 1
	if c >= 6:
		count3 += 1
	if c >= 8:
		count4 += 1
t = int(input())
for i in range(t):
	(s, c) = input().split()
	flag = True
	c = int(c)
	x = dic.get(c, 0)
	if s == '-':
		dic[c] = x - 1
		c = x
		if c == 8:
			count4 -= 1
		elif c == 6:
			count3 -= 1
		elif c == 4:
			count2 -= 1
		elif c == 2:
			count1 -= 1
	else:
		dic[c] = x + 1
		c = x + 1
		if c == 8:
			count4 += 1
		elif c == 6:
			count3 += 1
		elif c == 4:
			count2 += 1
		elif c == 2:
			count1 += 1
	if count4 >= 1 or (count3 >= 1 and count1 >= 2) or (count2 >= 1 and count1 >= 3) or (count2 >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
from collections import Counter
l = list(map(int, input().split()))
t = int(input())
d = Counter(l)
n2 = 0
n4 = 0
n6 = 0
n8 = 0
for i in d:
	n2 += d[i] // 2
	n4 += d[i] // 4
while t > 0:
	t -= 1
	(s, p) = map(str, input().split())
	p = int(p)
	if p in d:
		if s == '+':
			n2 -= d[p] // 2
			n4 -= d[p] // 4
			d[p] += 1
			n2 += d[p] // 2
			n4 += d[p] // 4
		else:
			n2 -= d[p] // 2
			n4 -= d[p] // 4
			d[p] -= 1
			n2 += d[p] // 2
			n4 += d[p] // 4
	else:
		d[p] = 1
	if n2 - 2 >= 2 and n4 >= 1:
		print('YES')
	else:
		print('NO')


from collections import Counter
input()
a = Counter(list(input().split()))
count1 = 0
count2 = 0
c = []
for i in a.values():
	count1 += i // 4
	count2 += i // 2
for i in range(int(input())):
	b = input().split()
	if b[0] == '+':
		try:
			if a[b[1]] % 2 == 1:
				count2 += 1
			if a[b[1]] % 4 == 3:
				count1 += 1
			a[b[1]] += 1
		except KeyError:
			a[b[1]] = 1
	else:
		if a[b[1]] % 4 == 0:
			count1 -= 1
		if a[b[1]] % 2 == 0:
			count2 -= 1
		a[b[1]] -= 1
	if count1 > 0 and count2 > 3:
		c.append('YES')
	else:
		c.append('NO')
print('\n'.join(c))


def increase(num_counter, seconds, fourths):
	if num_counter and num_counter % 4 == 0:
		fourths += 1
		seconds -= 1
	elif num_counter and num_counter % 2 == 0:
		seconds += 1
	return (seconds, fourths)

def decrease(num_counter, seconds, fourths):
	if num_counter and num_counter % 4 == 3:
		fourths -= 1
		seconds += 1
	elif num_counter and num_counter % 2 == 1:
		seconds -= 1
	return (seconds, fourths)
input()
arr = input().split()
q = int(input())
counter = dict()
fourths = 0
seconds = 0
for val in arr:
	counter[val] = counter.get(val, 0) + 1
	(seconds, fourths) = increase(counter[val], seconds, fourths)
while q > 0:
	q -= 1
	(op, val) = input().split()
	if op == '+':
		num_counter = counter[val] = counter.get(val, 0) + 1
		(seconds, fourths) = increase(num_counter, seconds, fourths)
	else:
		num_counter = counter[val] = counter[val] - 1
		(seconds, fourths) = decrease(num_counter, seconds, fourths)
	if fourths > 1 or (fourths == 1 and seconds > 1):
		print('YES')
	else:
		print('NO')


from collections import Counter, defaultdict
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
C = Counter(A)
CNT = defaultdict(lambda : 0)
for (k, v) in C.items():
	CNT[v] += 1
CNT_MAX = max(CNT.keys())
for _ in range(Q):
	(op, i) = input().split()
	i = int(i)
	if op == '+':
		CNT[C[i]] -= 1
		if C[i] == CNT_MAX:
			CNT_MAX += 1
		C[i] += 1
		CNT[C[i]] += 1
	else:
		CNT[C[i]] -= 1
		if C[i] == CNT_MAX and CNT[C[i]] == 0:
			CNT_MAX -= 1
		C[i] -= 1
		CNT[C[i]] += 1
	ans = False
	t = 8
	if CNT_MAX >= t:
		print('YES')
		continue
	else:
		for j in range(7, 0, -1):
			if j >= t:
				if CNT[j] > 0:
					ans = True
					break
			elif t == 4 and j >= 2:
				if CNT[j] >= 2:
					ans = True
					break
				elif CNT[j] > 0:
					t = 2
			elif j >= 6:
				if CNT[j] >= 2:
					ans = True
					break
				elif CNT[j] > 0:
					t = 2
			elif j >= 4:
				if CNT[j] >= 2:
					ans = True
					break
				elif CNT[j] > 0:
					t = 4
		if ans:
			print('YES')
		else:
			print('NO')


import os
import heapq
import sys, threading
import math
import bisect
import operator
from collections import defaultdict
sys.setrecursionlimit(10 ** 5)
from io import BytesIO, IOBase

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def power(x, p, m):
	res = 1
	while p:
		if p & 1:
			res = res * x % m
		x = x * x % m
		p >>= 1
	return res

def inar():
	return [int(k) for k in input().split()]

def lcm(num1, num2):
	return num1 * num2 // gcd(num1, num2)

def main():
	t = 1
	for _ in range(t):
		n = int(input())
		arr = inar()
		q = int(input())
		freq = [0] * (10 ** 5 + 1)
		ff = [0] * (10 ** 5 + 1)
		for i in range(n):
			freq[arr[i]] += 1
		for i in range(10 ** 5 + 1):
			if freq[i] == 0:
				continue
			ff[freq[i]] += 1
		f = 0
		s = 0
		t = 0
		for i in range(1, 10 ** 5 + 1):
			if ff[i] > 0:
				t = s
				s = f
				f = i
		for i in range(q):
			(sign, take) = input().split()
			take = int(take)
			com = 0
			if sign == '-':
				if ff[freq[take]] > 0:
					ff[freq[take]] -= 1
					freq[take] -= 1
					ff[freq[take]] += 1
					com = freq[take]
			else:
				ff[freq[take]] -= 1
				freq[take] += 1
				ff[freq[take]] += 1
				com = freq[take]
			lis = [0, 0, 0]
			if ff[f] > 0:
				lis.append(f)
			if ff[s] > 0:
				lis.append(s)
			if ff[t] > 0:
				lis.append(t)
			if com != f and com != s and (com != t):
				lis.append(com)
			lis.sort(reverse=True)
			f = lis[0]
			s = lis[1]
			t = lis[2]
			if f >= 8 or (f >= 4 and s >= 4) or (f >= 4 and f - 4 >= 2 and (s >= 2)) or (f >= 4 and ff[f] > 1) or (f >= 4 and s >= 2 and (ff[s] > 1)) or (f >= 4 and s >= 2 and (t >= 2)):
				print('YES')
			else:
				print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
import math
from decimal import *

def I():
	return int(sys.stdin.readline())

def IL():
	return list(map(int, sys.stdin.readline().strip().split()))

def ILS():
	return list(map(str, sys.stdin.readline().strip().split()))

def solve():
	n = I()
	l = IL()
	q = I()
	d = {}
	four = 0
	two = 0
	for ll in l:
		if ll not in d:
			d[ll] = 1
		elif ll not in d:
			d[ll] = 1
		else:
			d[ll] += 1
			if d[ll] % 4 == 0:
				four += 1
			if d[ll] % 2 == 0:
				two += 1
	for qq in range(q):
		(sign, p) = input().split(' ')
		ll = int(p)
		if sign == '+':
			if ll not in d:
				d[ll] = 1
			else:
				d[ll] += 1
				if d[ll] % 4 == 0:
					four += 1
				if d[ll] % 2 == 0:
					two += 1
		elif ll not in d or d[ll] == 0:
			pass
		else:
			d[ll] -= 1
			if (d[ll] + 1) % 4 == 0:
				four -= 1
			if (d[ll] + 1) % 2 == 0:
				two -= 1
		if four - 1 >= 0 and two - 2 >= 2:
			print('YES')
		else:
			print('NO')
solve()


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	p = 100005

	def check(t, f, s, e):
		if s > 0 and t > 0:
			return True
		if s > 0 and f > 0:
			return True
		if f > 0 and t > 1:
			return True
		if e > 0 or f > 1 or s > 1:
			return True
		return False
	n = int(input())
	a = list(map(int, input().split()))
	tc = [0] * p
	(f, t, e, s) = (0, 0, 0, 0)
	for i in a:
		tc[i] += 1
	for i in range(p):
		if tc[i] >= 8:
			e += 1
		elif tc[i] >= 6:
			s += 1
		elif tc[i] >= 4:
			f += 1
		elif tc[i] >= 2:
			t += 1
	for _ in range(int(input())):
		q = input().split(maxsplit=1)
		if q[0] == '+':
			x = int(q[1])
			tc[x] += 1
			if tc[x] == 8:
				e += 1
				s -= 1
			elif tc[x] == 6:
				s += 1
				f -= 1
			elif tc[x] == 4:
				f += 1
				t -= 1
			elif tc[x] == 2:
				t += 1
			if check(t, f, s, e):
				print('YES')
			else:
				print('NO')
		else:
			x = int(q[1])
			if tc[x] == 8:
				e -= 1
				s += 1
			elif tc[x] == 6:
				s -= 1
				f += 1
			elif tc[x] == 4:
				f -= 1
				t += 1
			elif tc[x] == 2:
				t -= 1
			tc[x] -= 1
			if check(t, f, s, e):
				print('YES')
			else:
				print('NO')


mv = 10 ** 5
n = int(input())
A = list(map(int, input().split()))
G = [0 for i in range(mv + 1)]
ns = 0
nr = 0
for i in A:
	G[i] = G[i] + 1
	if G[i] % 2 == 0:
		nr = nr + 1
	if G[i] % 4 == 0:
		ns = ns + 1
q = int(input())
for i in range(q):
	s = list(input().split())
	v = int(s[1])
	if s[0] == '+':
		G[v] = G[v] + 1
		if G[v] % 2 == 0:
			nr = nr + 1
		if G[v] % 4 == 0:
			ns = ns + 1
	else:
		if G[v] % 2 == 0:
			nr = nr - 1
		if G[v] % 4 == 0:
			ns = ns - 1
		G[v] = G[v] - 1
	if nr - 2 >= 2 and ns >= 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def check():
	if pairs[4] > 1 or (pairs[4] == 1 and pairs[2] >= 2):
		return True
	return False

def update(prev, i):
	pairs[4] += cnt[i] // 4 - prev // 4
	pairs[2] += cnt[i] % 4 // 2 - prev % 4 // 2
n = int(input())
cnt = defaultdict(lambda : 0)
l = list(map(int, input().split()))
pairs = {2: 0, 4: 0}
for i in l:
	cnt[i] += 1
for i in cnt:
	pairs[4] += cnt[i] // 4
	pairs[2] += cnt[i] % 4 // 2
for _ in range(int(input())):
	(sign, val) = input().split()
	prev = cnt[int(val)]
	if sign == '+':
		cnt[int(val)] += 1
	else:
		cnt[int(val)] -= 1
	update(prev, int(val))
	print('YES' if check() else 'NO')


n = int(input())
cnt = [0] * (pow(10, 5) + 5)
cnt2 = cnt4 = 0
l = list(map(int, input().split()))
for i in range(n):
	a = l[i]
	cnt2 -= cnt[a] // 2
	cnt4 -= cnt[a] // 4
	cnt[a] += 1
	cnt2 += cnt[a] // 2
	cnt4 += cnt[a] // 4
for i in range(int(input())):
	(sign, x) = input().split()
	cnt2 -= cnt[int(x)] // 2
	cnt4 -= cnt[int(x)] // 4
	if sign == '+':
		cnt[int(x)] += 1
	else:
		cnt[int(x)] -= 1
	cnt2 += cnt[int(x)] // 2
	cnt4 += cnt[int(x)] // 4
	if cnt4 >= 1 and cnt2 >= 4:
		print('YES')
	else:
		print('NO')


def main():
	number_plank = int(input())
	planks = input().split()
	number_events = int(input())
	events = [0] * number_events
	count = {}
	cnt2 = 0
	cnt4 = 0
	for x in planks:
		x = int(x)
		if not x in count:
			count[x] = 0
		cnt2 -= count[x] // 2
		cnt4 -= count[x] // 4
		count[x] += 1
		cnt2 += count[x] // 2
		cnt4 += count[x] // 4
	for x in range(number_events):
		events[x] = int(input().replace(' ', ''))
	for x in events:
		if not abs(x) in count:
			count[abs(x)] = 0
		cnt2 -= count[abs(x)] // 2
		cnt4 -= count[abs(x)] // 4
		if x > 0:
			count[abs(x)] += 1
		else:
			count[abs(x)] -= 1
		cnt2 += count[abs(x)] // 2
		cnt4 += count[abs(x)] // 4
		if cnt4 > 0 and cnt2 > 3:
			print('YES')
		else:
			print('NO')
main()


import sys
import collections
input = sys.stdin.readline

def printnl(val):
	sys.stdout.write(str(val) + '\n')
freq = collections.defaultdict(int)
squares = 0
rectangles = 0
n = int(input())
arr = list(map(int, input().split()))
for j in arr:
	freq[j] += 1
	if freq[j] % 4 == 0:
		squares += 1
		rectangles -= 1
	elif freq[j] % 2 == 0:
		rectangles += 1
queries = int(input())
while queries:
	query = input().split()
	op = query[0]
	x = int(query[1])
	if op == '+':
		freq[x] += 1
		if freq[x] % 4 == 0:
			squares += 1
			rectangles -= 1
		elif freq[x] % 2 == 0:
			rectangles += 1
	else:
		if freq[x] % 4 == 0:
			squares -= 1
			rectangles += 1
		elif freq[x] % 2 == 0:
			rectangles -= 1
		freq[x] -= 1
	if squares and squares + rectangles // 2 >= 2:
		printnl('YES')
	else:
		printnl('NO')
	queries -= 1


from collections import defaultdict
n = int(input())
a = input().split(' ')
d = defaultdict(int)
for i in range(n):
	a[i] = int(a[i])
	d[a[i]] += 1
numtwo = 0
numfour = 0
numsix = 0
num8 = 0
for i in d:
	if d[i] > 7:
		num8 += 1
	elif d[i] > 5:
		numsix += 1
	elif d[i] > 3:
		numfour += 1
	elif d[i] > 1:
		numtwo += 1
m = int(input())
for i in range(m):
	q = input().split(' ')
	q[1] = int(q[1])
	if q[0] == '+':
		d[q[1]] += 1
		if d[q[1]] == 4:
			numfour += 1
			numtwo -= 1
		elif d[q[1]] == 6:
			numfour -= 1
			numsix += 1
		elif d[q[1]] == 2:
			numtwo += 1
		elif d[q[1]] == 8:
			num8 += 1
			numsix -= 1
	elif q[0] == '-':
		d[q[1]] -= 1
		if d[q[1]] == 3:
			numfour -= 1
			numtwo += 1
		elif d[q[1]] == 5:
			numfour += 1
			numsix -= 1
		elif d[q[1]] == 1:
			numtwo -= 1
		elif d[q[1]] == 7:
			num8 -= 1
			numsix += 1
	if num8 > 0:
		print('YES')
	elif numsix >= 2:
		print('YES')
	elif numsix == 1 and (numtwo >= 1 or numfour >= 1):
		print('YES')
	elif numfour >= 2:
		print('YES')
	elif numfour == 1 and numtwo >= 2:
		print('YES')
	else:
		print('NO')


import sys, os
from collections import Counter
raw_input = sys.stdin.readline
input = raw_input
output = sys.stdout.write
list_input = lambda : raw_input().split()
get_list = lambda type, liste: list(map(type, liste))
explode_string = lambda string: list(string)
get_integer = lambda : int(raw_input())
get_float = lambda : float(raw_input())
get_string = lambda : raw_input().strip()
n = int(raw_input())
plat = get_list(int, list_input())
count_plat = Counter(plat)
two = 0
four = 0
for key in count_plat:
	tmp = count_plat[key]
	if tmp >= 4:
		four += tmp // 4
		tmp = tmp % 4
	if tmp >= 2:
		two += tmp // 2
		tmp = tmp % 2
t = get_integer()
for t_itr in range(t):
	q = list_input()
	tmp = count_plat[int(q[1])]
	if tmp >= 4:
		four -= tmp // 4
		tmp = tmp % 4
	if tmp >= 2:
		two -= tmp // 2
		tmp = tmp % 2
	tmp = count_plat[int(q[1])]
	if q[0] == '-':
		tmp -= 1
		count_plat[int(q[1])] -= 1
	else:
		tmp += 1
		count_plat[int(q[1])] += 1
	if tmp >= 4:
		four += tmp // 4
		tmp = tmp % 4
	if tmp >= 2:
		two += tmp // 2
		tmp = tmp % 2
	if four >= 2 or (four == 1 and two >= 2):
		print('YES')
	else:
		print('NO')


from collections import Counter
a = [0] * 100001
s = [0] * 9
int(input())
for c in map(int, input().split()):
	a[c] += 1
for (i, n) in enumerate(a):
	s[min(n, 8)] += 1
for _ in range(int(input())):
	(op, n) = input().split()
	n = int(n)
	s[min(a[n], 8)] -= 1
	a[n] = a[n] + (1 if op == '+' else -1)
	s[min(a[n], 8)] += 1
	if s[8]:
		print('YES')
	elif sum(s[4:9]) > 1:
		print('YES')
	elif sum(s[6:8]) and sum(s[2:4]):
		print('YES')
	elif sum(s[4:8]) and sum(s[2:4]) > 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
n = int(input())
a = int_array()
dick = {}
for i in a:
	dick[i] = dick.get(i, 0) + 1
twos = fours = 0
for i in dick:
	twos += dick[i] // 2
	fours += dick[i] // 4
q = int(input())
for _ in range(q):
	s = input().strip()
	x = int(s[2:])
	if x in dick:
		tb = dick[x] // 2
		fb = dick[x] // 4
	else:
		tb = fb = 0
	if s[0] == '+':
		dick[x] = dick.get(x, 0) + 1
	else:
		dick[x] -= 1
	tn = dick[x] // 2
	fn = dick[x] // 4
	fours += fn - fb
	twos += tn - tb
	t = twos - 2 * fours
	if fours >= 2:
		print('YES')
	elif fours == 1 and t >= 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
n = int(I1())
a = list(I())
k = int(I1())
d = {}
for x in a:
	d[x] = d.get(x, 0) + 1
(sum2, sum4) = (0, 0)
for x in d.values():
	if x >= 4:
		sum4 += x // 4
		sum2 += x % 4 // 2
	elif x >= 2:
		sum2 += x // 2
for i in range(k):
	s = I1().split()
	x = int(s[1])
	if x in d:
		if d[x] >= 4:
			sum4 -= d[x] // 4
			sum2 -= d[x] % 4 // 2
		elif d[x] >= 2:
			sum2 -= d[x] // 2
	if s[0] == '+':
		d[x] = d.get(x, 0) + 1
	else:
		d[x] -= 1
	if d[x] >= 4:
		sum4 += d[x] // 4
		sum2 += d[x] % 4 // 2
	elif d[x] >= 2:
		sum2 += d[x] // 2
	if sum2 >= 2 and sum4 >= 1 or sum4 >= 2:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections
n = int(input())
initial = list(map(int, input().split()))
dict1 = collections.defaultdict(int)
for s in range(len(initial)):
	dict1[initial[s]] += 1
q = int(input())
a8 = set([])
a6 = set([])
a4 = set([])
a2 = set([])
for s in dict1.keys():
	if dict1[s] >= 8:
		a8.add(s)
	elif dict1[s] >= 6:
		a6.add(s)
	elif dict1[s] >= 4:
		a4.add(s)
	elif dict1[s] >= 2:
		a2.add(s)
for j in range(q):
	ops = [k for k in input().split()]
	sign = ops[0]
	num = int(ops[1])
	if sign == '+':
		dict1[num] += 1
	else:
		dict1[num] -= 1
	a8.discard(num)
	a6.discard(num)
	a4.discard(num)
	a2.discard(num)
	if dict1[num] >= 8:
		a8.add(num)
	elif dict1[num] >= 6:
		a6.add(num)
	elif dict1[num] >= 4:
		a4.add(num)
	elif dict1[num] >= 2:
		a2.add(num)
	if len(a8) > 0 or len(a6) > 0 or len(a4) > 0:
		checker = 0
		if len(a8) > 0:
			checker = 1
		if len(a6) > 0:
			if len(a6) > 1:
				checker = 1
			if len(a4) > 0:
				checker = 1
			if len(a2) > 0:
				checker = 1
		if len(a4) > 0:
			if len(a4) > 1:
				checker = 1
			if len(a2) > 1:
				checker = 1
		if checker == 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


MAX = 100001
n = int(input())
l = list(map(int, input().split()))
(eight, six, four, two) = (0, 0, 0, 0)
num = [0] * MAX
for i in range(n):
	num[l[i]] += 1
	if num[l[i]] == 8:
		eight += 1
	if num[l[i]] == 6:
		six += 1
	if num[l[i]] == 4:
		four += 1
	if num[l[i]] == 2:
		two += 1
for _ in range(int(input())):
	s = input().split()
	if s[0] == '+':
		num[int(s[1])] += 1
		if num[int(s[1])] == 8:
			eight += 1
		if num[int(s[1])] == 6:
			six += 1
		if num[int(s[1])] == 4:
			four += 1
		if num[int(s[1])] == 2:
			two += 1
	else:
		if num[int(s[1])] == 8:
			eight -= 1
		if num[int(s[1])] == 6:
			six -= 1
		if num[int(s[1])] == 4:
			four -= 1
		if num[int(s[1])] == 2:
			two -= 1
		num[int(s[1])] -= 1
	if eight > 0 or (six > 0 and two > 1) or (four > 0 and two > 2) or (four > 1):
		print('YES')
	else:
		print('NO')


n = int(input())
a = map(int, input().split())
cnt = [0] * 100001
k = 0
m = 0
for i in a:
	cnt[i] += 1
	if cnt[i] % 4 == 0:
		k += 1
	if cnt[i] % 2 == 0:
		m += 1
q = int(input())
for i in range(q):
	(cr, x) = input().split()
	x = int(x)
	if cr == '+':
		cnt[x] += 1
		if cnt[x] % 4 == 0:
			k += 1
		if cnt[x] % 2 == 0:
			m += 1
		n += 1
	else:
		if cnt[x] % 4 == 0:
			k -= 1
		if cnt[x] % 2 == 0:
			m -= 1
		cnt[x] -= 1
		n -= 1
	if k > 1 or (k == 1 and m > 3):
		print('YES')
	else:
		print('NO')


from collections import Counter
count_start_boards = int(input())
start_boards = list(map(int, input().split()))
count_events = int(input())
boards = Counter(start_boards)
count2 = sum([value // 2 for value in boards.values()])
count4 = sum([value // 4 for value in boards.values()])
for _ in range(count_events):
	event = input().split()
	board = int(event[1])
	count2 -= boards[board] // 2
	count4 -= boards[board] // 4
	if event[0] == '+':
		boards[board] += 1
	else:
		boards[board] -= 1
	count2 += boards[board] // 2
	count4 += boards[board] // 4
	print('YES') if count4 > 0 and count2 > 3 else print('NO')


from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
q = int(input())
x = []
for _ in range(q):
	x.append(input().split())

def check(d):
	g8 = g6 = g4 = g2 = 0
	for v in d.values():
		if v >= 8:
			g8 += 1
		elif v >= 6:
			g6 += 1
		elif v >= 4:
			g4 += 1
		elif v >= 2:
			g2 += 1
	return (g8, g6, g4, g2)
(g8, g6, g4, g2) = check(a)
for (s, v) in x:
	v = int(v)
	if s == '+':
		a[v] += 1
		q = a[v]
		if q == 8:
			g8 += 1
			g6 -= 1
		if q == 6:
			g6 += 1
			g4 -= 1
		if q == 4:
			g4 += 1
			g2 -= 1
		if q == 2:
			g2 += 1
	else:
		a[v] -= 1
		q = a[v]
		if q == 7:
			g8 -= 1
			g6 += 1
		if q == 5:
			g6 -= 1
			g4 += 1
		if q == 3:
			g4 -= 1
			g2 += 1
		if q == 1:
			g2 -= 1
	ans = False
	if g8 > 0:
		ans = True
	if g6 > 0 and (g4 > 0 or g2 > 0):
		ans = True
	if g6 > 1:
		ans = True
	if g4 > 0 and g2 > 1:
		ans = True
	if g4 > 1:
		ans = True
	if ans:
		print('YES')
	else:
		print('NO')


n = int(input())
inp = list(map(int, input().split()))
mx = 100001
u = [0] * mx
d = [0] * 10
for i in range(n):
	u[inp[i]] += 1
for i in range(mx):
	if u[i] < 9:
		d[u[i]] += 1
	else:
		d[9] += 1
q = int(input())
ans = []
for _ in range(q):
	(sgn, b) = input().split()
	b = int(b)
	cup = 1
	if sgn == '-':
		cup = -1
	if u[b] < 9 and cup == 1 or (u[b] <= 9 and cup == -1):
		d[u[b]] -= 1
		u[b] += cup
		d[u[b]] += 1
	d1 = d[:]
	for i in range(4, 10):
		if d1[i] > 0:
			d1[i] -= 1
			d1[i - 4] += 1
			break
	else:
		ans.append('NO')
		continue
	for i in range(2, 10):
		if d1[i] > 0:
			d1[i] -= 1
			d1[i - 2] += 1
			break
	else:
		ans.append('NO')
		continue
	for i in range(2, 10):
		if d1[i] > 0:
			d1[i] -= 1
			d1[i - 2] + 1
			break
	else:
		ans.append('NO')
		continue
	ans.append('YES')
print('\n'.join(ans))


n = int(input())
ct = [0 for _ in range(100000)]
for x in input().split():
	ct[int(x) - 1] += 1
q = int(input())
(ct2, ct4, ct6, ct8) = (0, 0, 0, 0)
for r in range(100000):
	if ct[r] >= 8:
		ct8 += 1
	if ct[r] >= 6:
		ct6 += 1
	if ct[r] >= 4:
		ct4 += 1
	if ct[r] >= 2:
		ct2 += 1
for _ in range(q):
	p = input().split()
	r = int(p[1]) - 1
	if p[0] == '+':
		ct[r] += 1
		if ct[r] == 8:
			ct8 += 1
		if ct[r] == 6:
			ct6 += 1
		if ct[r] == 4:
			ct4 += 1
		if ct[r] == 2:
			ct2 += 1
	else:
		ct[r] -= 1
		if ct[r] == 7:
			ct8 -= 1
		if ct[r] == 5:
			ct6 -= 1
		if ct[r] == 3:
			ct4 -= 1
		if ct[r] == 1:
			ct2 -= 1
	if ct8 >= 1 or (ct6 >= 1 and ct2 >= 2) or ct4 >= 2 or (ct4 >= 1 and ct2 >= 3):
		print('YES')
		continue
	else:
		print('NO')
		continue


import math
import sys
from collections import Counter
from queue import Queue
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(str, input().split())

def twosum(val, W):
	C = Counter(W)
	out = 0
	for i in range(len(W)):
		if C[W[i]] > 0:
			C[W[i]] -= 1
			if C[val - W[i]] > 0:
				out += 1
				C[val - W[i]] -= 1
	return out
N = inp()
A = inlt()
Q = inp()
C = Counter(A)
ge2 = set()
ge4 = set()
for c in C:
	if C[c] >= 4:
		ge4.add(c)
	elif C[c] >= 2:
		ge2.add(c)
for q in range(Q):
	(sgn, num) = invr()
	num = int(num)
	if sgn == '+':
		C[num] += 1
		if C[num] == 4:
			ge2.remove(num)
			ge4.add(num)
		elif C[num] == 2:
			ge2.add(num)
	else:
		C[num] -= 1
		if C[num] == 3:
			ge4.remove(num)
			ge2.add(num)
		elif C[num] == 1:
			ge2.remove(num)
	if len(ge4) >= 1:
		if len(ge2) >= 2 or len(ge4) > 1:
			print('YES')
		else:
			fl = True
			for s in ge4:
				if C[s] >= 6 and len(ge2) == 1 or C[s] >= 8:
					print('YES')
					fl = False
					break
			if fl:
				print('NO')
	else:
		print('NO')


n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
d = {}
n2 = n4 = 0
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
	if d[i] % 2 == 0:
		n2 += 1
	if d[i] == 4:
		n4 += 1
while q:
	b1 = input().split()
	ch = b1[0]
	x = int(b1[1])
	if ch == '+':
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
		if d[x] % 2 == 0:
			n2 += 1
		if d[x] == 4:
			n4 += 1
	else:
		d[x] -= 1
		if d[x] % 2 != 0:
			n2 -= 1
		if d[x] == 3:
			n4 -= 1
	if n4 > 0 and n2 >= 4:
		print('YES')
	else:
		print('NO')
	q -= 1


n = int(input())
a = list(map(int, input().split()))
cnt4 = 0
cnt8 = 0
cnt2 = 0
cnt6 = 0
vf = [0] * 100005
for i in range(n):
	vf[a[i]] += 1
	if vf[a[i]] == 8:
		cnt8 += 1
	if vf[a[i]] == 6:
		cnt6 += 1
	if vf[a[i]] == 4:
		cnt4 += 1
	if vf[a[i]] == 2:
		cnt2 += 1
q = int(input())
for _ in range(q):
	(sign, x) = input().split()
	x = int(x)
	if sign == '+':
		vf[x] += 1
		if vf[x] == 8:
			cnt8 += 1
		if vf[x] == 4:
			cnt4 += 1
		if vf[x] == 2:
			cnt2 += 1
		if vf[x] == 6:
			cnt6 += 1
	else:
		if vf[x] == 8:
			cnt8 -= 1
		if vf[x] == 4:
			cnt4 -= 1
		if vf[x] == 2:
			cnt2 -= 1
		if vf[x] == 6:
			cnt6 -= 1
		vf[x] -= 1
	if cnt8 >= 1 or (cnt2 >= 2 + 1 and cnt4 >= 1) or cnt4 >= 2 or (cnt6 >= 1 and cnt2 >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
ar = list(map(int, input().split()))
dic = [0] * (10 ** 5 + 5)
cnt = [0] * (10 ** 5 + 5)
for i in ar:
	dic[i] += 1
	cnt[dic[i] - 1] += 1
q = int(input())
while q > 0:
	s = input().split(' ')
	x = int(s[1])
	if s[0] == '+':
		dic[x] += 1
		cnt[dic[x] - 1] += 1
	else:
		cnt[dic[x] - 1] -= 1
		dic[x] -= 1
	if cnt[7] > 0 or cnt[3] >= 2 or (cnt[5] > 0 and cnt[1] >= 2) or (cnt[3] > 0 and cnt[1] >= 3):
		print('YES')
	else:
		print('NO')
	q -= 1


n = int(input())
s = [int(x) for x in input().split()]
pos = [0] * 100005
(c4, c2) = (0, 0)
for i in range(len(s)):
	pos[s[i]] += 1
	if pos[s[i]] % 4 == 0:
		c4 += 1
		c2 -= 1
	elif pos[s[i]] % 2 == 0:
		c2 += 1
for _ in range(int(input())):
	L = input().split()
	(h1, h2) = (str(L[0]), int(L[1]))
	if h1 == '+':
		pos[h2] += 1
		tt = pos[h2]
		if tt % 4 == 0:
			c4 += 1
			c2 -= 1
		elif tt % 2 == 0:
			c2 += 1
	else:
		tt = pos[h2]
		if tt % 4 == 0:
			c4 -= 1
			c2 += 1
		elif tt % 2 == 0:
			c2 -= 1
		pos[h2] -= 1
	print('YES' if c4 > 1 or (c4 == 1 and c2 > 1) else 'NO')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
n = ii()
a = li()
d = collections.Counter(a)
ans = []
sum2 = 0
sum4 = 0
for i in d:
	sum2 += d[i] // 2
	sum4 += d[i] // 4
for _ in range(ii()):
	s = input().split()
	if s[0] == '+':
		d[int(s[1])] += 1
		if d[int(s[1])] % 4 == 0:
			sum4 += 1
		if d[int(s[1])] % 2 == 0:
			sum2 += 1
	else:
		d[int(s[1])] -= 1
		if d[int(s[1])] % 4 == 3:
			sum4 -= 1
		if d[int(s[1])] % 2 == 1:
			sum2 -= 1
	if sum2 >= 4 and sum4 >= 1:
		ans.append('YES')
	else:
		ans.append('NO')
print(*ans, sep='\n')


import math
n = int(input())
a = list(map(int, input().split()))
d = False
q = int(input())
A = {}
n4 = 0
n2 = 0
for i in range(n):
	if a[i] in A:
		A[a[i]] += 1
		if A[a[i]] > 4 and A[a[i]] % 2 == 0:
			n2 += 1
		if A[a[i]] == 4:
			n4 += 1
		if A[a[i]] == 2:
			n2 += 1
	else:
		A[a[i]] = 1
for i in range(q):
	r = input().split()
	c = int(r[1])
	if r[0][0] == '+':
		if c in A:
			A[c] += 1
			if A[c] > 4 and A[c] % 2 == 0:
				n2 += 1
			if A[c] == 4:
				n4 += 1
			if A[c] == 2:
				n2 += 1
		else:
			A[c] = 1
	else:
		A[c] -= 1
		if A[c] > 4 and A[c] % 2 == 1:
			n2 -= 1
		if A[c] == 3:
			n4 -= 1
		if A[c] == 1:
			n2 -= 1
	if n2 >= 3 and n4 >= 1 or n4 >= 2:
		print('YES')
	else:
		print('NO')


from collections import Counter

def tc():
	n = int(input())
	a = list(map(int, input().split()))
	q = int(input())
	planks = Counter(a)
	twos = set()
	fours = set()
	sixes = set()
	eights = set()
	for (p, cnt) in planks.items():
		if cnt >= 8:
			eights.add(p)
		elif cnt >= 6:
			sixes.add(p)
		elif cnt >= 4:
			fours.add(p)
		elif cnt >= 2:
			twos.add(p)
	for _ in range(q):
		(code, plank) = input().split()
		plank = int(plank)
		for s in (twos, fours, sixes, eights):
			s.discard(plank)
		if code == '+':
			planks[plank] += 1
		else:
			planks[plank] -= 1
		cnt = planks[plank]
		if cnt >= 8:
			eights.add(plank)
		elif cnt >= 6:
			sixes.add(plank)
		elif cnt >= 4:
			fours.add(plank)
		elif cnt >= 2:
			twos.add(plank)
		if eights or (sixes and twos):
			print('YES')
		elif len(fours) + len(sixes) >= 2:
			print('YES')
		elif fours and len(twos) >= 2:
			print('YES')
		else:
			print('NO')
tc()


import sys
from collections import Counter

def main():
	_ = int(sys.stdin.readline())
	C = Counter((int(x) for x in sys.stdin.readline().split()))
	Q = int(sys.stdin.readline())
	(A, B) = (set(), set())
	for (k, v) in C.items():
		if v > 1:
			A.add(k)
		if v > 3:
			B.add(k)
	for q in range(Q):
		(a, b) = sys.stdin.readline().split()
		b = int(b)
		if a == '+':
			C[b] += 1
			if C[b] > 1:
				A.add(b)
			if C[b] > 3:
				B.add(b)
		else:
			C[b] -= 1
			if C[b] < 2 and b in A:
				A.remove(b)
			if C[b] < 4 and b in B:
				B.remove(b)
		if len(B) == 0:
			print('NO')
			continue
		if len(B) > 1 or len(A) > 2:
			print('YES')
			continue
		b = next(iter(B))
		t = 0
		for a in A:
			s = C[a]
			if a == b:
				s -= 4
			t += s // 2
		print('YES' if t > 1 else 'NO')
main()


def add(e):
	if e in dic:
		dic[e] += 1
	else:
		dic[e] = 1
	if dic[e] % 4 == 0:
		return (1, -1)
	elif dic[e] % 2 == 0:
		return (0, 1)
	else:
		return (0, 0)

def remove(e):
	dic[e] -= 1
	if (dic[e] + 1) % 4 == 0:
		return (-1, +1)
	elif (dic[e] + 1) % 2 == 0:
		return (0, -1)
	else:
		return (0, 0)
n = int(input())
l = map(int, input().split(' '))
dic = {}
for e in l:
	add(e)
square = 0
rec = 0
for e in dic:
	square += dic[e] // 4
	rec += dic[e] % 4 // 2
n = int(input())
for i in range(n):
	line = input().split(' ')
	if line[0] == '+':
		(a, b) = add(int(line[1]))
		square += a
		rec += b
	else:
		(a, b) = remove(int(line[1]))
		square += a
		rec += b
	if square >= 2 or (square >= 1 and rec >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
count = [0 for x in range(100002)]
a = 0
b = 0
for i in range(n):
	a -= count[l[i]] // 2
	b -= count[l[i]] // 4
	count[l[i]] += 1
	a += count[l[i]] // 2
	b += count[l[i]] // 4
for i in range(int(input())):
	(x, y) = input().split()
	a -= count[int(y)] // 2
	b -= count[int(y)] // 4
	if x == '+':
		count[int(y)] += 1
	else:
		count[int(y)] -= 1
	a += count[int(y)] // 2
	b += count[int(y)] // 4
	if a >= 4 and b >= 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
q = int(input())
arr1 = [0] * (10 ** 5 + 1)
arr2 = [0] * (10 ** 5 + 1)
d = defaultdict(set)
for i in a:
	arr1[i] += 1
	if arr1[i] >= 4:
		d[4].add(i)
		d[2].discard(i)
	elif arr1[i] >= 2:
		d[2].add(i)
for _ in range(q):
	(s, l) = input().split()
	l = int(l)
	if s == '+':
		if arr1[l] == 3:
			d[2].discard(l)
			d[4].add(l)
		elif arr1[l] == 1:
			d[2].add(l)
		arr1[l] += 1
	else:
		if arr1[l] == 2:
			d[2].discard(l)
		elif arr1[l] == 4:
			d[2].add(l)
			d[4].discard(l)
		arr1[l] -= 1
	if len(d[4]) >= 2 or (len(d[4]) == 1 and len(d[2]) >= 2):
		print('YES')
	elif len(d[4]) == 1:
		x = d[4].pop()
		if arr1[x] >= 6 and len(d[2]) >= 1 or arr1[x] >= 8:
			print('YES')
		else:
			print('NO')
		d[4].add(x)
	else:
		print('NO')


from collections import Counter
_ = input()
c = Counter([int(x) for x in input().split()])
(a, b) = (sum((c[v] // i for v in c)) for i in (2, 4))
for _ in range(int(input())):
	(s, v) = input().split()
	v = int(v)
	prev = c[v]
	if s == '+':
		c[v] += 1
		if prev // 2 < c[v] // 2:
			a += 1
		if prev // 4 < c[v] // 4:
			b += 1
	else:
		c[v] -= 1
		if prev // 2 > c[v] // 2:
			a -= 1
		if prev // 4 > c[v] // 4:
			b -= 1
	print('YES') if b > 0 and a >= 4 else print('NO')


from collections import Counter as cs
n = int(input())
ls = [int(a) for a in input().split()]
q = int(input())
dt = dict(cs(ls))
(sq, pair) = (0, 0)
for i in dt.values():
	if i > 3:
		sq += int(i / 4)
		pair += int((i - int(i / 4) * 4) / 2)
	elif i > 1:
		pair += int(i / 2)
for i in range(q):
	x = input()
	x2 = int(x[2:])
	if x2 in dt:
		if dt[x2] > 3:
			sq -= int(dt[x2] / 4)
			pair -= int((dt[x2] - int(dt[x2] / 4) * 4) / 2)
		elif dt[x2] > 1:
			pair -= int(dt[x2] / 2)
	if x[0] == '-':
		dt[x2] -= 1
	elif x2 in dt:
		dt[x2] += 1
	else:
		dt[x2] = 1
	if dt[x2] > 3:
		sq += int(dt[x2] / 4)
		pair += int((dt[x2] - int(dt[x2] / 4) * 4) / 2)
	elif dt[x2] > 1:
		pair += int(dt[x2] / 2)
	if sq >= 1 and pair > 1:
		print('YES')
	elif sq > 1:
		print('YES')
	else:
		print('NO')


def low_bound(list, item):
	low = -1
	high = len(list)
	while high - low > 1:
		mid = (low + high) // 2
		if list[mid][0] > item:
			low = mid
		else:
			high = mid
	return low

def high_bound(list, item):
	low = -1
	high = len(list)
	while high - low > 1:
		mid = (low + high) // 2
		if list[mid][0] >= item:
			low = mid
		else:
			high = mid
	return high
n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = [[0, i] for i in range(100000)]
d_ind = [i for i in range(100000)]
for i in range(n):
	d[a[i] - 1][0] += 1
d.sort(reverse=True)
for i in range(100000):
	d_ind[d[i][1]] = i
for i in range(q):
	(sign, leng) = list(map(str, input().split()))
	leng = int(leng)
	ind_swap1 = 0
	ind_swap2 = 0
	if sign == '+':
		ind_swap1 = d_ind[leng - 1]
		ind_swap2 = high_bound(d, d[d_ind[leng - 1]][0] + 1)
		d[d_ind[leng - 1]][0] += 1
	else:
		ind_swap1 = d_ind[leng - 1]
		ind_swap2 = low_bound(d, d[d_ind[leng - 1]][0] - 1)
		d[d_ind[leng - 1]][0] -= 1
	(d[ind_swap1], d[ind_swap2]) = (d[ind_swap2], d[ind_swap1])
	(d_ind[d[ind_swap1][1]], d_ind[d[ind_swap2][1]]) = (d_ind[d[ind_swap2][1]], d_ind[d[ind_swap1][1]])
	fl4 = False
	fl21 = False
	fl22 = False
	for j in range(100000):
		if d[j][0] >= 8:
			fl4 = fl21 = fl22 = True
			break
		elif d[j][0] >= 6:
			if fl4:
				fl21 = True
				fl22 = True
				break
			else:
				fl4 = True
				if fl21:
					fl22 = True
					break
				else:
					fl21 = True
		elif d[j][0] >= 4:
			if fl4:
				fl21 = True
				fl22 = True
				break
			else:
				fl4 = True
		elif d[j][0] >= 2:
			if fl21:
				fl22 = True
				if fl4:
					break
			else:
				fl21 = True
			if not fl4:
				break
		elif not fl4 or not fl21 or (not fl22):
			break
	if fl4 and fl21 and fl22:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())
sys.setrecursionlimit(1500)

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_right(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		d = dict(l)
		(a2, a4, a6, a8) = (0, 0, 0, 0)
		for x in d:
			if d[x] >= 8:
				a8 += 1
			elif d[x] >= 6 and d[x] <= 7:
				a6 += 1
			elif d[x] >= 4 and d[x] <= 5:
				a4 += 1
			elif d[x] >= 2 and d[x] <= 3:
				a2 += 1
		q = I()
		for x in range(q):
			(a, b) = input().split()
			b = int(b)
			if a == '+':
				if d.get(b, -1) != -1:
					d[b] += 1
				else:
					d[b] = 1
				if d[b] == 8:
					a8 += 1
					a6 -= 1
				elif d[b] == 6:
					a6 += 1
					a4 -= 1
				elif d[b] == 4:
					a4 += 1
					a2 -= 1
				elif d[b] == 2:
					a2 += 1
			else:
				d[b] -= 1
				if d[b] == 7:
					a8 -= 1
					a6 += 1
				elif d[b] == 5:
					a6 -= 1
					a4 += 1
				elif d[b] == 3:
					a2 += 1
					a4 -= 1
				elif d[b] == 1:
					a2 -= 1
			flag = 0
			if a8 >= 1:
				flag = 1
			elif a6 >= 1 and a2 >= 1 or (a6 >= 1 and a4 >= 1):
				flag = 1
			elif a6 >= 2:
				flag = 1
			elif a4 >= 2:
				flag = 1
			elif a4 >= 1 and a2 >= 2:
				flag = 1
			if flag:
				yes()
			else:
				no()
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
fours = 0
twos = 0
for i in d.values():
	if i >= 4:
		fours += i // 4
		twos += i % 4 // 2
	elif i >= 2:
		twos += 1
e = int(input())
for i in range(e):
	[m, p] = input().split()
	p = int(p)
	if m == '+':
		if p in d:
			if d[p] == 1:
				twos += 1
			elif d[p] == 3:
				fours += 1
				twos -= 1
			elif d[p] > 4 and d[p] % 4 == 3:
				fours += 1
				twos -= 1
			elif d[p] > 4 and d[p] % 2 == 1:
				twos += 1
			d[p] += 1
		else:
			d[p] = 1
	else:
		if d[p] > 5 and d[p] % 4 == 0:
			fours -= 1
			twos += 1
		elif d[p] > 5 and d[p] % 2 == 0:
			twos -= 1
		elif d[p] == 4:
			fours -= 1
			twos += 1
		elif d[p] == 2:
			twos -= 1
		d[p] -= 1
	if fours > 0 and 2 * (fours - 1) + twos >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
v = list(map(int, input().split()))
from collections import Counter
c = Counter(v)
s = 0
r = 0
for i in c.values():
	s += i // 4
	r += i // 2
q = int(input())
for _ in range(q):
	ss = list(map(str, input().split()))
	sgn = ss[0]
	x = int(ss[1])
	if sgn == '+':
		s -= c[x] // 4
		r -= c[x] // 2
		if x not in c.keys():
			c[x] = 1
		else:
			c[x] += 1
		s += c[x] // 4
		r += c[x] // 2
	else:
		s -= c[x] // 4
		r -= c[x] // 2
		c[x] -= 1
		s += c[x] // 4
		r += c[x] // 2
	if s >= 1 and r >= 4:
		print('YES')
	else:
		print('NO')


import os
import heapq
import sys
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

def inpt():
	return [int(k) for k in input().split()]

def main():
	n = int(input())
	ar = inpt()
	f = 0
	t = 0
	d = defaultdict(int)
	for i in ar:
		d[i] += 1
	for i in d.keys():
		f += d[i] // 4
		t += d[i] % 4 // 2
	q = int(input())
	for _ in range(q):
		s = input()
		ar = s.split(' ')
		v = int(ar[1])
		if ar[0] == '-':
			d[v] -= 1
			if d[v] % 4 != 0:
				if d[v] % 4 == 3:
					f -= 1
					t += 1
				elif d[v] % 4 == 1:
					t -= 1
		else:
			d[v] += 1
			if d[v] % 4 == 0:
				f += 1
				t -= 1
			elif d[v] % 4 == 2:
				t += 1
		if f > 0:
			if f >= 2 or t >= 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def chk(s2, s4):
	if len(s4) >= 2:
		print('YES')
		return
	elif len(s4) == 1:
		tmp = s4.pop()
		s4.add(tmp)
		if len(s2) > 2:
			print('YES')
			return
		elif len(s2) == 2 and d[tmp] - 4 >= 2:
			print('YES')
			return
		elif d[tmp] >= 8:
			print('YES')
			return
		else:
			print('NO')
			return
	else:
		print('NO')
		return
t = int(input())
li = [int(i) for i in input().split(' ')]
d = {}
s2 = set()
s4 = set()
for i in li:
	d[i] = d.get(i, 0) + 1
	if d[i] >= 2:
		s2.add(i)
	if d[i] >= 4:
		s4.add(i)
t = int(input())
for _ in range(t):
	o = input().split()
	n = int(o[1])
	if o[0] == '+':
		d[n] = d.get(n, 0) + 1
		if d[n] >= 2:
			s2.add(n)
		if d[n] >= 4:
			s4.add(n)
	else:
		d[n] = d.get(n, 0) - 1
		if d[n] < 2:
			s2.discard(n)
		if d[n] < 4:
			s4.discard(n)
	chk(s2, s4)


from sys import stdin
import collections
n = int(stdin.readline().strip())
P = list(map(int, stdin.readline().strip().split(' ')))
planks = collections.defaultdict(int)
num4 = 0
num2 = 0
num6 = 0
num8 = 0

def add(p):
	global planks, num4, num2, num6, num8
	planks[p] += 1
	if planks[p] == 4:
		num4 += 1
	if planks[p] == 2:
		num2 += 1
	if planks[p] == 6:
		num6 += 1
	if planks[p] == 8:
		num8 += 1

def remove(p):
	global planks, num4, num2, num6, num8
	planks[p] -= 1
	if planks[p] == 3:
		num4 -= 1
	if planks[p] == 1:
		num2 -= 1
	if planks[p] == 5:
		num6 -= 1
	if planks[p] == 7:
		num8 -= 1
for p in P:
	add(p)
t = int(stdin.readline().strip())
for _ in range(t):
	(sign, length) = stdin.readline().strip().split(' ')
	length = int(length)
	if sign == '+':
		add(length)
	else:
		remove(length)
	if num4 == 0:
		print('NO')
	elif num4 >= 2:
		print('YES')
	elif num8 == 1:
		print('YES')
	elif num6 == 1 and num2 - num4 >= 1:
		print('YES')
	elif num4 == 1 and num2 - num4 >= 2:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
arr = [int(x) for x in input().split()]
sq = 0
rec = 0
d = defaultdict(lambda : 0)
for i in arr:
	d[i] += 1
	if d[i] % 2 == 0:
		rec += 1
	if d[i] % 4 == 0:
		sq += 1
for _ in range(int(input())):
	l = [x for x in input().split()]
	p = int(l[1])
	if l[0] == '+':
		d[p] += 1
		if d[p] % 2 == 0:
			rec += 1
		if d[p] % 4 == 0:
			sq += 1
	else:
		d[p] -= 1
		if d[p] % 2 != 0:
			rec -= 1
		if d[p] % 4 == 3:
			sq -= 1
	if sq >= 1 and rec >= 4:
		print('YES')
	else:
		print('NO')


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
print = stdout.write
letters = ascii_letters[:26]
n = int(input())
have = dict()
kcnt = 0
dcnt = 0
tcnt = 0
pcnt = 0
for i in map(int, input().split()):
	if i not in have:
		have[i] = 0
	have[i] += 1
	if have[i] == 2:
		dcnt += 1
	if have[i] == 4:
		kcnt += 1
		dcnt -= 1
	if have[i] == 6:
		tcnt += 1
	if have[i] == 8:
		pcnt += 1
for _ in range(int(input())):
	(op, val) = input().strip().split()
	val = int(val)
	if op == '+':
		if val not in have:
			have[val] = 0
		have[val] += 1
		if have[val] == 2:
			dcnt += 1
		if have[val] == 4:
			kcnt += 1
			dcnt -= 1
		if have[val] == 6:
			tcnt += 1
		if have[val] == 8:
			pcnt += 1
	else:
		have[val] -= 1
		if have[val] == 3:
			kcnt -= 1
			dcnt += 1
		if have[val] == 1:
			dcnt -= 1
		if have[val] == 5:
			tcnt -= 1
		if have[val] == 7:
			pcnt -= 1
		if have[val] == 0:
			del have[val]
	if pcnt:
		print('YES\n')
	elif tcnt and (dcnt or kcnt - 1) or tcnt >= 2:
		print('YES\n')
	elif kcnt and dcnt >= 2 or kcnt >= 2:
		print('YES\n')
	else:
		print('NO\n')


t = int(input())
planks = dict()
for size in (int(i) for i in input().split()):
	if size in planks:
		planks[size] += 1
	else:
		planks[size] = 1
twos = set()
fours = set()
sixes = set()
eights = set()
for (size, amount) in planks.items():
	if amount >= 2:
		twos.add(size)
	if amount >= 4:
		fours.add(size)
	if amount >= 6:
		sixes.add(size)
	if amount >= 8:
		eights.add(size)
for _ in range(int(input())):
	(event, size) = input().split()
	size = int(size)
	if event == '+':
		if size in planks:
			planks[size] += 1
		else:
			planks[size] = 1
		if planks[size] == 2:
			twos.add(size)
		elif planks[size] == 4:
			fours.add(size)
		elif planks[size] == 6:
			sixes.add(size)
		elif planks[size] == 8:
			eights.add(size)
	else:
		planks[size] -= 1
		if planks[size] == 1:
			twos.remove(size)
		elif planks[size] == 3:
			fours.remove(size)
		elif planks[size] == 5:
			sixes.remove(size)
		elif planks[size] == 7:
			eights.remove(size)
	suitable = len(fours) >= 1 and len(twos) >= 3 or len(fours) >= 2 or (len(sixes) >= 1 and len(twos) >= 2) or (len(eights) >= 1)
	if suitable:
		print('YES')
	else:
		print('NO')


n = int(input())
squares = 0
rectangles = 0
shapes = [0 for i in range(100001)]
for i in input().split():
	i = int(i)
	shapes[i] += 1
	if shapes[i] % 2 == 0:
		rectangles += 1
	if shapes[i] % 4 == 0:
		squares += 1
for i in range(int(input())):
	action = input()
	i = int(action[1:])
	if action[0] == '+':
		shapes[i] += 1
		if shapes[i] % 2 == 0:
			rectangles += 1
		if shapes[i] % 4 == 0:
			squares += 1
	else:
		shapes[i] -= 1
		if shapes[i] % 2:
			rectangles -= 1
		if shapes[i] % 4 == 3:
			squares -= 1
	if rectangles >= 4 and squares >= 1:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict as dd
from collections import deque
from functools import *
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def inc(d, c):
	d[c] = d[c] + 1 if c in d else 1

def li():
	return [int(xx) for xx in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [xx for xx in input().split()]

def fi():
	return int(input())

def pro(a):
	return reduce(lambda a, b: a * b, a)

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def isvalid(i, j):
	return 0 <= i < n and 0 <= j < n

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')

def ck(x, y):
	return int(bin(x)[2:] + bin(y)[2:], 2)
t = 1
while t > 0:
	t -= 1
	n = fi()
	a = li()
	d = {}
	q = fi()
	for i in a:
		inc(d, i)
	b = 0
	f = [0 for i in range(9)]
	for p in d:
		if d[p] >= 8:
			f[8] += 1
		else:
			f[d[p]] += 1
	for i in range(q):
		(z, p) = input().split()
		flag = 0
		p = int(p)
		if z == '+':
			if p in d and d[p] < 8:
				f[d[p]] -= 1
			inc(d, p)
			if d[p] <= 8:
				f[d[p]] += 1
		else:
			d[p] = d[p] - 1
			if d[p] < 8:
				f[d[p] + 1] -= 1
				f[d[p]] += 1
		if f[8] > 0:
			flag = 1
		else:
			for j in range(6, 8):
				if f[j] > 1:
					flag = 1
					break
				if f[j] == 1:
					for k in range(2, 8):
						if j != k:
							if f[k] > 0:
								flag = 1
								break
			if f[4] + f[5] > 1 or (f[4] + f[5] == 1 and f[2] + f[3] >= 2):
				flag = 1
		print('YES' if flag else 'NO')


from collections import defaultdict
n = int(input())
lst = list(map(int, input().split()))
dic = defaultdict(int)
counter2 = 0
counter4 = 0
for i in lst:
	dic[i] += 1
for i in dic.values():
	if i >= 8:
		counter2 += 2
		counter4 += 1
	elif i >= 6:
		counter2 += 1
		counter4 += 1
	elif i >= 4:
		counter4 += 1
	elif i >= 2:
		counter2 += 1
q = int(input())
for i in range(q):
	s = input()
	sign = s[0]
	dig = int(s[1:])
	if dic[dig] >= 8:
		counter2 -= 2
		counter4 -= 1
	elif dic[dig] >= 6:
		counter2 -= 1
		counter4 -= 1
	elif dic[dig] >= 4:
		counter4 -= 1
	elif dic[dig] >= 2:
		counter2 -= 1
	if sign == '-':
		dic[dig] -= 1
	else:
		dic[dig] += 1
	if dic[dig] >= 8:
		counter2 += 2
		counter4 += 1
	elif dic[dig] >= 6:
		counter2 += 1
		counter4 += 1
	elif dic[dig] >= 4:
		counter4 += 1
	elif dic[dig] >= 2:
		counter2 += 1
	if counter4 >= 1 and counter2 >= 2 or counter4 >= 2:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
array = list(map(int, input().split()))
count = {}
pop = {}
maxV = 0
for i in array:
	if i not in count:
		count[i] = 0
	count[i] += 1
	if count[i] not in pop:
		pop[count[i]] = set()
	pop[count[i]].add(i)
	maxV = max(maxV, count[i])

def calculate(maxV, count, pop):
	if maxV >= 8:
		return 'YES'
	if maxV >= 4 and len(pop[maxV]) >= 2:
		return 'YES'
	if maxV < 4:
		return 'NO'
	if maxV >= 6:
		if len(pop[2]) > 1:
			return 'YES'
		else:
			return 'NO'
	elif len(pop[2]) > 2 or len(pop[4]) > 1:
		return 'YES'
	else:
		return 'NO'
for _ in range(int(input())):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		if b not in count:
			count[b] = 0
		count[b] += 1
		if count[b] not in pop:
			pop[count[b]] = set()
		pop[count[b]].add(b)
		maxV = max(maxV, count[b])
		print(calculate(maxV, count, pop))
	else:
		pop[count[b]].remove(b)
		count[b] -= 1
		if len(pop[maxV]) == 0:
			maxV -= 1
		print(calculate(maxV, count, pop))


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
d = {}
l = {2: set(), 4: set()}
for i in range(n):
	if a[i] not in d:
		d[a[i]] = 1
	else:
		d[a[i]] += 1
		if d[a[i]] == 2:
			l[2].add(a[i])
		if d[a[i]] == 4:
			l[4].add(a[i])
			l[2].remove(a[i])
(l2, l4) = (len(l[2]), len(l[4]))
for _ in range(int(input())):
	(ch, x) = input().strip().split()
	x = int(x)
	if ch == '+':
		if x not in d:
			d[x] = 1
		else:
			d[x] += 1
		if d[x] == 2:
			l[2].add(x)
			l2 += 1
		if d[x] == 4:
			l[4].add(x)
			l4 += 1
			l[2].remove(x)
			l2 -= 1
		f = 0
		if l4 > 1:
			f = 1
		if l4 == 1:
			e = l[4].pop()
			if d[e] // 4 > 1:
				f = 1
			if 5 < d[e] < 8 and l2 > 0:
				f = 1
			if l2 > 1:
				f = 1
			l[4].add(e)
		if f:
			print('YES')
		else:
			print('NO')
	else:
		d[x] -= 1
		if d[x] == 1:
			l[2].remove(x)
			l2 -= 1
		if d[x] == 3:
			l[4].remove(x)
			l4 -= 1
			l[2].add(x)
			l2 += 1
		f = 0
		if l4 > 1:
			f = 1
		if l4 == 1:
			e = l[4].pop()
			if d[e] // 4 > 1:
				f = 1
			if 5 < d[e] < 8 and l2 > 0:
				f = 1
			if l2 > 1:
				f = 1
			l[4].add(e)
		if f:
			print('YES')
		else:
			print('NO')


from collections import defaultdict
n = int(input())
A = [int(i) for i in input().split()]
biggerthan8 = 0
biggerthan6 = 0
biggerthan4 = 0
biggerthan2 = 0
counting = defaultdict(int)
for i in A:
	counting[i] += 1
	if counting[i] == 8:
		biggerthan8 += 1
	if counting[i] == 6:
		biggerthan6 += 1
	if counting[i] == 4:
		biggerthan4 += 1
	if counting[i] == 2:
		biggerthan2 += 1
q = int(input())
for sub_q in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		counting[y] += 1
		if counting[y] == 8:
			biggerthan8 += 1
		if counting[y] == 6:
			biggerthan6 += 1
		if counting[y] == 4:
			biggerthan4 += 1
		if counting[y] == 2:
			biggerthan2 += 1
	elif x == '-':
		counting[y] -= 1
		if counting[y] == 7:
			biggerthan8 -= 1
		if counting[y] == 5:
			biggerthan6 -= 1
		if counting[y] == 3:
			biggerthan4 -= 1
		if counting[y] == 1:
			biggerthan2 -= 1
	if biggerthan8 >= 1 or (biggerthan6 >= 1 and biggerthan2 >= 2) or (biggerthan4 >= 1 and biggerthan2 >= 3) or (biggerthan4 >= 2):
		print('YES')
	else:
		print('NO')


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import PriorityQueue
import sys
n = int(input())
a = list(map(int, stdin.readline().split()))
q = int(input())
count = Counter(a)
sq = defaultdict(lambda : 0)
doub = defaultdict(lambda : 0)
extra = defaultdict(lambda : 0)
sq_count = 0
doub_count = 0
for i in count.keys():
	sq[i] = count[i] // 4
	count[i] = count[i] % 4
	doub[i] = count[i] // 2
	count[i] = count[i] % 2
	extra[i] = count[i]
	sq_count += sq[i]
	doub_count += doub[i]
for _ in range(q):
	qu = list(input().split())
	if qu[0] == '+':
		temp = int(qu[1])
		if extra[temp] > 0:
			extra[temp] -= 1
			doub[temp] += 1
			doub_count += 1
			if doub[temp] >= 2:
				doub[temp] -= 2
				sq[temp] += 1
				doub_count -= 2
				sq_count += 1
		else:
			extra[temp] += 1
	else:
		temp = int(qu[1])
		if extra[temp] > 0:
			extra[temp] -= 1
		elif doub[temp] > 0:
			doub[temp] -= 1
			doub_count -= 1
			extra[temp] += 1
		else:
			sq[temp] -= 1
			sq_count -= 1
			doub[temp] += 1
			doub_count += 1
			extra[temp] += 1
	if sq_count > 1:
		print('YES')
	elif sq_count == 0:
		print('NO')
	elif doub_count >= 2:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnts = Counter(a)
rngs = [0, 0, 0, 0, 0]
for cnt in cnts.values():
	if cnt >= 8:
		rngs[0] += 1
	if cnt >= 6:
		rngs[1] += 1
	elif cnt >= 4:
		rngs[2] += 1
	elif cnt >= 2:
		rngs[3] += 1
	else:
		rngs[4] += 1
q = int(input())
for _ in range(q):
	(op, tmp) = input().split()
	x = int(tmp)
	prev = cnts[x]
	if op == '+':
		cnts[x] += 1
	elif op == '-':
		cnts[x] -= 1
	new = cnts[x]
	if prev >= 8:
		rngs[0] -= 1
	if prev >= 6:
		rngs[1] -= 1
	elif prev >= 4:
		rngs[2] -= 1
	elif prev >= 2:
		rngs[3] -= 1
	else:
		rngs[4] -= 1
	if new >= 8:
		rngs[0] += 1
	if new >= 6:
		rngs[1] += 1
	elif new >= 4:
		rngs[2] += 1
	elif new >= 2:
		rngs[3] += 1
	else:
		rngs[4] += 1
	if rngs[0] >= 1 or rngs[1] >= 2 or (rngs[1] >= 1 and (rngs[2] >= 1 or rngs[3] >= 1)) or (rngs[2] >= 2) or (rngs[2] >= 1 and rngs[3] >= 2):
		print('YES')
	else:
		print('NO')


import math, sys
from collections import defaultdict, Counter, deque
INF = float('inf')
MOD = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def isPrime(n):
	if n <= 1:
		return False
	i = 2
	while i ** 2 <= n:
		if n % i == 0:
			return False
		i += 1
	return True

def primeFactors(n):
	factors = []
	i = 2
	while i ** 2 <= n:
		while n % i == 0:
			factors.append(i)
			n //= i
		i += 1
	if n > 1:
		factors.append(n)
	return factors

def vars():
	return map(int, input().split())

def array():
	return list(map(int, input().split()))

def main():
	n = int(input())
	arr = array()
	m = defaultdict(int)
	for num in arr:
		m[num] += 1
	two = four = six = eight = 0
	for k in m:
		if m[k] >= 8:
			eight += 1
		if m[k] >= 6:
			six += 1
		if m[k] >= 4:
			four += 1
		if m[k] >= 2:
			two += 1
	q = int(input())
	for i in range(q):
		(sign, num) = input().split()
		num = int(num)
		if sign == '+':
			m[num] += 1
			if m[num] == 8:
				eight += 1
			if m[num] == 6:
				six += 1
			if m[num] == 4:
				four += 1
			if m[num] == 2:
				two += 1
		else:
			m[num] -= 1
			if m[num] == 7:
				eight -= 1
			if m[num] == 5:
				six -= 1
			if m[num] == 3:
				four -= 1
			if m[num] == 1:
				two -= 1
		res = 'NO'
		if eight:
			res = 'YES'
		elif six and two > 1:
			res = 'YES'
		elif four and two >= 3:
			res = 'YES'
		elif four >= 2:
			res = 'YES'
		print(res)
t = 1
for _ in range(t):
	main()


import sys
input = sys.stdin.readline

def name(op, h, f):
	ele = op.split()
	if int(ele[1]) not in h:
		h[int(ele[1])] = 1
	elif ele[0] == '+':
		h[int(ele[1])] += 1
		if h[int(ele[1])] % 2 == 0:
			f[2] += 1
		if h[int(ele[1])] % 4 == 0:
			f[4] += 1
		if h[int(ele[1])] % 6 == 0:
			f[6] += 1
	else:
		if h[int(ele[1])] % 2 == 0:
			f[2] -= 1
		if h[int(ele[1])] % 4 == 0:
			f[4] -= 1
		if h[int(ele[1])] % 6 == 0:
			f[6] -= 1
		h[int(ele[1])] -= 1
	if f[4] >= 2:
		print('YES')
	elif f[2] - 3 >= 1 and f[6] >= 1:
		print('YES')
	elif f[4] >= 1 and f[2] - 2 >= 2:
		print('YES')
	else:
		print('NO')

def solution():
	l = int(input())
	arr = list(map(lambda x: int(x), input().split()))
	n = int(input())
	h = {}
	f = {2: 0, 6: 0, 4: 0}
	for ele in arr:
		if ele not in h:
			h[ele] = 1
		else:
			h[ele] += 1
			if h[ele] % 2 == 0:
				f[2] += 1
			if h[ele] % 4 == 0:
				f[4] += 1
			if h[ele] % 6 == 0:
				f[6] += 1
	for i in range(0, n):
		op = input()
		name(op, h, f)
solution()


n = int(input())
a = list(map(int, input().split()))
b = {}
for el in a:
	if el in b:
		b[el] += 1
	else:
		b[el] = 1
a = b
q = int(input())
(n2, n4, n6, n8) = (0, 0, 0, 0)
for i in a.values():
	if i >= 2:
		n2 += 1
	if i >= 4:
		n4 += 1
	if i >= 6:
		n6 += 1
	if i >= 8:
		n8 += 1
for _ in range(q):
	(s, k) = input().split()
	k = int(k)
	if s == '+':
		if k not in a:
			a[k] = 0
		a[k] += 1
		if a[k] == 2:
			n2 += 1
		elif a[k] == 4:
			n4 += 1
		elif a[k] == 6:
			n6 += 1
		elif a[k] == 8:
			n8 += 1
	else:
		a[k] -= 1
		if a[k] == 1:
			n2 -= 1
		elif a[k] == 3:
			n4 -= 1
		elif a[k] == 5:
			n6 -= 1
		elif a[k] == 7:
			n8 -= 1
	if n8 > 0:
		print('YES')
		continue
	if n6 > 0 and n2 >= 2:
		print('YES')
		continue
	if n4 > 0 and n2 >= 3:
		print('YES')
		continue
	if n4 >= 2:
		print('YES')
		continue
	print('NO')


import math
import sys
import itertools
import random
import bisect
import heapq
import collections

def lcm(x, y):
	return x * y // math.gcd(x, y)

def hcf(x, y):
	return math.gcd(x, y)

def primes(n):
	prime = [True for _ in range(0, n + 1)]
	res = []
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[p] = False
		p += 1
	for i in range(0, n + 1):
		if prime[i] == True:
			res.append(i)
	return res

def primeFactors(n):
	res = []
	while n % 2 == 0:
		res.append(2)
		n //= 2
	for i in range(3, math.sqrt(n) + 1, 2):
		while n % i == 0:
			res.append(i)
			n //= i
	if n > 2:
		res.append(n)
	return res
n = int(input())
l = list(map(int, input().strip().split()))
q = int(input())
h = [0 for a in range(0, 10 ** 5 + 1)]
d_4 = {}
d_2 = {}
rect = 0
for i in l:
	h[i] += 1
	temp = h[i]
	div4 = temp // 4
	if div4 > 0:
		if i in d_4:
			d_4[i] = 1
			if i in d_2:
				rect -= d_2[i]
				d_2.pop(i)
		else:
			d_4.update({i: 1})
	if temp >= 4:
		temp -= 4
	div2 = temp // 2
	if i in d_2:
		old = d_2[i]
	else:
		old = 0
	d_2.update({i: div2})
	rect = rect + (div2 - old)
for _ in range(0, q):
	t = input().split()
	if t[0] == '+':
		i = int(t[1])
		h[i] += 1
		temp = h[i]
		div4 = temp // 4
		if div4 > 0:
			if i in d_4:
				d_4[i] = 1
				if i in d_2:
					rect -= d_2[i]
					d_2.pop(i)
			else:
				d_4.update({i: 1})
		if temp >= 4:
			temp -= 4
		div2 = temp // 2
		if i in d_2:
			old = d_2[i]
		else:
			old = 0
		d_2.update({i: div2})
		rect = rect + (div2 - old)
	else:
		i = int(t[1])
		h[i] -= 1
		temp = h[i]
		div4 = temp // 4
		if div4 <= 0:
			if i in d_4:
				d_4.pop(i)
		if div4 > 0:
			if i in d_4:
				d_4[i] = 1
				if i in d_2:
					rect -= d_2[i]
					d_2.pop(i)
			else:
				d_4.update({i: 1})
		if temp >= 4:
			temp -= 4
		div2 = temp // 2
		if i in d_2:
			old = d_2[i]
		else:
			old = 0
		d_2.update({i: div2})
		rect = rect + (div2 - old)
	d4l = len(d_4)
	flag = 0
	res = 0
	if d4l > 0:
		res = rect
		if res >= 2 or d4l - 1 > 0:
			print('YES')
			flag = 1
		else:
			print('NO')
	else:
		print('NO')


import sys, math as mt
import heapq as hp
import collections as cc
import bisect as bi
import math as mt
I = lambda : list(map(int, input().split()))
for tc in range(1):
	(n,) = I()
	l = I()
	f = cc.defaultdict(int)
	for i in l:
		f[i] += 1
	four = 0
	two = 0
	for i in f:
		if f[i] >= 4:
			four += f[i] // 4
		if f[i] >= 2:
			two += f[i] // 2
	for tc in range(int(input())):
		s = input().split()
		four -= f[int(s[1])] // 4
		two -= f[int(s[1])] // 2
		if s[0] == '+':
			f[int(s[1])] += 1
		else:
			f[int(s[1])] -= 1
		four += f[int(s[1])] // 4
		two += f[int(s[1])] // 2
		if four:
			if four >= 2:
				print('YES')
			elif two - 2 >= 2:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')


def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = mpos(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj
import sys
import threading
from math import *
sys.setrecursionlimit(300000)
threading.stack_size(10 ** 8)
po = int(log(10 ** 18)) + 2
li = []
for i in range(po):
	li.append(3 ** i)
li = li[::-1]
s = sum(li)
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = {}
	(sq, rec) = (0, 0)
	for i in a:
		if i in cnt:
			cnt[i] += 1
		else:
			cnt[i] = 1
	for i in cnt:
		sq += cnt[i] // 4
		rec += cnt[i] // 2
	for i in range(int(input())):
		(x, y) = input().split()
		y = int(y)
		if x == '+':
			if y in cnt:
				cnt[y] += 1
			else:
				cnt[y] = 1
			if cnt[y] % 2 == 0:
				rec += 1
			if cnt[y] % 4 == 0:
				sq += 1
		else:
			cnt[y] -= 1
			if cnt[y] % 2 == 1:
				rec -= 1
			if cnt[y] % 4 == 3:
				sq -= 1
		if sq > 0 and rec > 3:
			print('YES')
		else:
			print('NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
c = [0] * 100001
m2 = set()
m4 = set()
m6 = set()
m8 = set()
for i in range(n):
	k = a[i]
	c[k] += 1
	if c[k] == 2:
		m2.add(k)
	elif c[k] == 4:
		m4.add(k)
	elif c[k] == 6:
		m6.add(k)
	elif c[k] == 8:
		m8.add(k)
for i in range(q):
	(s, b) = input().split()
	k = int(b)
	if s == '+':
		c[k] += 1
		if c[k] == 2:
			m2.add(k)
		elif c[k] == 4:
			m4.add(k)
		elif c[k] == 6:
			m6.add(k)
		elif c[k] == 8:
			m8.add(k)
		n += 1
	else:
		n -= 1
		c[k] -= 1
		if c[k] == 1:
			m2.remove(k)
		elif c[k] == 3:
			m4.remove(k)
		elif c[k] == 5:
			m6.remove(k)
		elif c[k] == 7:
			m8.remove(k)
	if n < 8 or len(m4) == 0:
		print('NO')
	elif len(m8) > 0 or (len(m6) > 0 and len(m2) > 1) or len(m4) > 1 or (len(m2) > 2):
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from collections import defaultdict as dc
n = N()
p = RLL()
dic = dc(int)
two = set()
four = set()
for i in p:
	dic[i] += 1
for x in dic:
	if dic[x] >= 2:
		two.add(x)
		if dic[x] >= 4:
			four.add(x)
q = N()
for _ in range(q):
	tmp = input()
	ff = tmp[0]
	x = int(tmp[1:])
	if ff == '+':
		dic[x] += 1
		if dic[x] == 2:
			two.add(x)
		elif dic[x] == 4:
			four.add(x)
	else:
		dic[x] -= 1
		if dic[x] == 1:
			two.remove(x)
		elif dic[x] == 3:
			four.remove(x)
	if not four:
		print('NO')
	elif len(four) >= 2:
		print('YES')
	elif len(two) >= 3:
		print('YES')
	elif len(two) == 2:
		l1 = four.pop()
		if dic[l1] >= 6:
			print('YES')
		else:
			print('NO')
		four.add(l1)
	else:
		l1 = four.pop()
		if dic[l1] >= 8:
			print('YES')
		else:
			print('NO')
		four.add(l1)


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import Counter, defaultdict

class SortedList:

	def __init__(self, iterable=None, _load=200):
		if iterable is None:
			iterable = []
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __bool__(self):
		return self._len != 0

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

class SortedCounter:

	def __init__(self, data, discard=True):
		self.counter = Counter(data)
		self._discard = discard
		self._keys = SortedList(self.counter.keys())
		self._values = SortedList(self.counter.values())
		self.reversed_counter = defaultdict(set)
		for (key, value) in self.counter.items():
			self.reversed_counter[value].add(key)

	def __getitem__(self, item):
		return self.counter[item]

	def __setitem__(self, key, value):
		del self[key]
		if value <= 0 and self._discard:
			return
		self.counter[key] = value
		self._keys.add(key)
		self._values.add(value)
		self.reversed_counter[value].add(key)

	def __delitem__(self, key):
		if key in self.counter:
			v = self.counter[key]
			self._values.remove(v)
			self.reversed_counter[v].remove(key)
			if not self.reversed_counter[v] and self._discard:
				del self.reversed_counter[v]
			self._keys.remove(key)
			del self.counter[key]

	def add_value(self, key, value):
		if key in self.counter:
			value += self.counter[key]
		self[key] = value

	def most_common(self, k=int(1000000000.0), remain_same_value=False):
		if k <= 0 or not self:
			return []
		k = min(k, len(self._keys))
		result = []
		for value in reversed(self._values):
			for key in self.reversed_counter[value]:
				result.append((key, value))
				k -= 1
				if k == 0 and (not remain_same_value):
					return result
			if k <= 0:
				return result
		raise AssertionError('Bug!')

	def keys(self):
		return self._keys

	def values(self):
		return self._values

	def items(self):
		return ((key, self.counter[key]) for key in self._keys)

	def __len__(self):
		return len(self._keys)

	def __bool__(self):
		return len(self._keys) != 0

	def __contains__(self, item):
		return item in self.counter

	def __iter__(self):
		return iter(self._keys)

	def __repr__(self):
		return 'SortedDict({0})'.format(dict(self.counter))

class SortedSet(set):

	def __init__(self, data):
		data = set(data)
		self.elements = SortedList(data)
		super().__init__(data)

	def add(self, element) -> None:
		if not super().__contains__(element):
			self.elements.add(element)
		super().add(element)

	def remove(self, element) -> None:
		self.elements.remove(element)
		super().remove(element)

	def discard(self, element) -> None:
		self.elements.discard(element)
		super().discard(element)

	def __getitem__(self, item):
		return self.elements[item]

	def __iter__(self):
		return iter(self.elements)

	def __repr__(self):
		return 'SortedSet({0})'.format(list(self.elements))
n = itg()
counter = SortedCounter(mpint())

def judge():
	most = [v for (k, v) in counter.most_common(3)]
	most.extend([0] * (3 - len(most)))
	if most[0] >= 8:
		return True
	if most[0] >= 6 and most[1] >= 2:
		return True
	return most[0] >= 4 and (most[1] >= 4 or (most[1] >= 2 and most[2] >= 2))
for _ in range(itg()):
	(q, x) = inp().split()
	x = int(x)
	if q == '+':
		counter.add_value(x, 1)
	else:
		counter.add_value(x, -1)
	print('YES' if judge() else 'NO')


T = int(input())
init = [int(x) for x in input().split()]
storage = {}
pairs = 0
quads = 0
octs = 0
for i in init:
	try:
		storage[i] += 1
	except:
		storage[i] = 1
	if storage[i] % 2 == 0:
		pairs += 1
	if storage[i] % 4 == 0:
		quads += 1
Q = int(input())
for q in range(Q):
	ls = [x for x in input().split()]
	op = ls[0]
	l = int(ls[1])
	if op == '+':
		try:
			storage[l] += 1
		except:
			storage[l] = 1
		if storage[l] % 2 == 0:
			pairs += 1
		if storage[l] % 4 == 0:
			quads += 1
	else:
		storage[l] -= 1
		if storage[l] % 2 == 1:
			pairs -= 1
		if storage[l] % 4 == 3:
			quads -= 1
	if quads >= 2:
		print('YES')
	elif quads and pairs >= 4:
		print('YES')
	else:
		print('NO')


def check(count):
	cond = count[7] >= 1
	cond1 = count[3] + count[4] + count[5] + count[6] > 1
	cond_sq = count[3] + count[4] + count[5] + count[6] == 1
	cond_rect = count[5] + count[1] + count[2] + count[6] > 1
	if cond or cond1 or (cond_sq and cond_rect):
		return 1
	return 0
n = int(input())
planks = list(map(int, input().split()))
dct = {}
for size in planks:
	val = dct.get(size, 0)
	val += 1
	dct[size] = val
count = [0 for _ in range(8)]
for size in dct:
	val = dct[size]
	idx = [val - 1, 7][int(val >= 8)]
	count[idx] += 1
q = int(input())
ans = []
for _ in range(q):
	s = input()
	size = int(s[2:])
	val = dct.get(size, 0)
	if s[0] == '+':
		if val:
			if val < 8:
				count[val - 1] -= 1
				count[val] += 1
		else:
			count[0] += 1
		dct[size] = val + 1
	else:
		if 1 < val <= 8:
			count[val - 1] -= 1
			count[val - 2] += 1
		elif val == 1:
			count[0] -= 1
		dct[size] = val - 1
	ans.append(['NO', 'YES'][check(count)])
for x in ans:
	print(x)


mxn = 10 ** 5 + 5
n = int(input())
arr = [0] * mxn
nums = list(map(int, input().split()))
sm2 = 0
sm4 = 0
for num in nums:
	sm2 -= arr[num] // 2
	sm4 -= arr[num] // 4
	arr[num] += 1
	sm2 += arr[num] // 2
	sm4 += arr[num] // 4
for q in range(int(input())):
	s = input().split()
	num = int(s[1])
	sm2 -= arr[num] // 2
	sm4 -= arr[num] // 4
	if s[0] == '+':
		arr[num] += 1
	else:
		arr[num] -= 1
	sm2 += arr[num] // 2
	sm4 += arr[num] // 4
	if sm2 >= 4 and sm4 >= 1:
		print('YES')
	else:
		print('NO')


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
from decimal import Decimal
from fractions import Fraction
INF = float('inf')
mod = int(1000000000.0) + 7
n = int(data())
a = mdata()
k1 = 0
k2 = 0
q = int(data())
d1 = dd(int)
for i in range(n):
	d1[a[i]] += 1
	if d1[a[i]] % 2 == 0:
		k1 += 1
	if d1[a[i]] % 4 == 0:
		k2 += 1
for i in range(q):
	s = data().split()
	x = int(s[1])
	if s[0] == '+':
		d1[x] += 1
		if d1[x] % 2 == 0:
			k1 += 1
		if d1[x] % 4 == 0:
			k2 += 1
	else:
		if d1[x] % 2 == 0:
			k1 -= 1
		if d1[x] % 4 == 0:
			k2 -= 1
		d1[x] -= 1
	if k1 >= 4 and k2 >= 1:
		out('YES')
	else:
		out('NO')


t = 1
for _ in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	freq = {}
	for i in a:
		if i not in freq.keys():
			freq[i] = 0
		freq[i] += 1
	(sdg4, sdg2) = (0, 0)
	check = False
	for val in freq.values():
		sdg4 += val // 4
		sdg2 += val // 2
	Q = int(input())
	for q in range(Q):
		s = list(input().rstrip().split())
		num = int(s[1])
		if s[0] == '+':
			if num not in freq:
				freq[num] = 1
			else:
				if freq[num] % 4 == 3:
					sdg4 += 1
				if freq[num] % 2 == 1:
					sdg2 += 1
				freq[num] += 1
			n += 1
		else:
			if freq[num] % 2 == 0:
				sdg2 -= 1
			if freq[num] % 4 == 0:
				sdg4 -= 1
			freq[num] -= 1
			n -= 1
		if n < 8:
			print('NO')
			continue
		if sdg2 >= 4:
			chk = True
		else:
			chk = False
		if chk and sdg4 > 0:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
n = int(input())
L = list(map(int, input().split()))
q = int(input())
ct2 = 0
ct4 = 0
ct6 = 0
ct8 = 0
ct = [0] * (10 ** 5 + 10)
for i in L:
	ct[i] += 1
for i in ct:
	if i > 1:
		ct2 += 1
	if i > 3:
		ct4 += 1
	if i > 5:
		ct6 += 1
	if i > 7:
		ct8 += 1
for i in ' ' * q:
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		ct[b] += 1
		if ct[b] == 2:
			ct2 += 1
		if ct[b] == 4:
			ct4 += 1
		if ct[b] == 6:
			ct6 += 1
		if ct[b] == 8:
			ct8 += 1
	else:
		ct[b] -= 1
		if ct[b] == 1:
			ct2 -= 1
		if ct[b] == 3:
			ct4 -= 1
		if ct[b] == 5:
			ct6 -= 1
		if ct[b] == 7:
			ct8 -= 1
	if ct2 >= 2 and ct6 >= 1:
		print('YES')
	elif ct2 >= 3 and ct4 >= 1:
		print('YES')
	elif ct4 >= 2:
		print('YES')
	elif ct8:
		print('YES')
	else:
		print('NO')


import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
N = 100010
n = ni()
a = nl()
q = ni()
mmp = [0] * N
for i in a:
	mmp[i] += 1
(cnt1, cnt2) = (0, 0)
for i in range(0, N):
	if mmp[i] >= 4:
		cnt1 += 1
	cnt2 += mmp[i] // 2
for _ in range(q):
	(ch, x) = input().split(' ')
	x = int(x)
	if ch == '+':
		cnt2 -= mmp[x] // 2
		mmp[x] += 1
		cnt2 += mmp[x] // 2
		if mmp[x] == 4:
			cnt1 += 1
	else:
		cnt2 -= mmp[x] // 2
		mmp[x] -= 1
		cnt2 += mmp[x] // 2
		if mmp[x] == 3:
			cnt1 -= 1
	print('YES' if cnt1 > 0 and cnt2 > 3 else 'NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0] * 100005
c = set(a)
lena = 0
lenb = 0
for i in a:
	b[i] += 1
for i in b:
	lena += i // 4
	lenb += i // 2
for __ in range(q):
	(x, y) = map(str, input().split())
	y = int(y)
	lena -= b[y] // 4
	lenb -= b[y] // 2
	if x == '+':
		b[y] += 1
	else:
		b[y] -= 1
	lena += b[y] // 4
	lenb += b[y] // 2
	if lena > 0 and lenb > 3:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
q = int(input())
h = {}
for i in a:
	if i not in h:
		h[i] = 0
	h[i] += 1
(squ, rec) = (0, 0)
for i in h:
	squ += h[i] // 4
	rec += h[i] // 2
for _ in range(q):
	(t, x) = input().split()
	x = int(x)
	if x not in h:
		h[x] = 0
	squ -= h[x] // 4
	rec -= h[x] // 2
	if t == '+':
		h[x] += 1
		squ += h[x] // 4
		rec += h[x] // 2
		if squ > 0 and rec > 3:
			print('YES')
		else:
			print('NO')
	else:
		h[x] -= 1
		squ += h[x] // 4
		rec += h[x] // 2
		if squ > 0 and rec > 3:
			print('YES')
		else:
			print('NO')


n = int(input())
a = list(map(int, input().split()))
event = int(input())
cnt4 = set()
cnt2 = []
cnt = [0 for x in range(100001)]
for e in a:
	cnt[e] += 1
	if cnt[e] % 2 == 0:
		cnt2.append(e)
		if cnt[e] >= 4:
			cnt4.add(e)
for i in range(event):
	(sign, number) = input().split()
	number = int(number)
	if sign == '-':
		cnt[number] -= 1
		if cnt[number] % 2:
			cnt2.remove(number)
			if cnt[number] < 4 and cnt[number] == 3:
				cnt4.remove(number)
	else:
		cnt[number] += 1
		if cnt[number] % 2 == 0:
			cnt2.append(number)
			if cnt[number] >= 4:
				cnt4.add(number)
	if len(cnt4) and len(cnt2) >= 4:
		print('YES')
	else:
		print('NO')


n = int(input())
s1 = set()
s2 = set()
s3 = set()
d = dict()
for x in [int(s) for s in input().split()]:
	if x in s1:
		s1.remove(x)
		s2.add(x)
	elif x in s2:
		s2.remove(x)
		s3.add(x)
	elif x in s3:
		s3.remove(x)
		d[x] = 4
	elif d.get(x, 0) != 0:
		d[x] += 1
	else:
		s1.add(x)
for q in range(int(input())):
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		if x in s1:
			s1.remove(x)
			s2.add(x)
		elif x in s2:
			s2.remove(x)
			s3.add(x)
		elif x in s3:
			s3.remove(x)
			d[x] = 4
		elif d.get(x, 0) != 0:
			d[x] += 1
		else:
			s1.add(x)
	elif x in s1:
		s1.remove(x)
	elif x in s2:
		s2.remove(x)
		s1.add(x)
	elif x in s3:
		s3.remove(x)
		s2.add(x)
	elif d.get(x, 0) != 0:
		if d[x] == 4:
			d.pop(x)
			s3.add(x)
		else:
			d[x] -= 1
	if len(d) == 0:
		print('NO')
		continue
	if len(d) > 1:
		print('YES')
		continue
	p = d.popitem()
	d[p[0]] = p[1]
	if p[1] >= 8:
		print('YES')
		continue
	if p[1] >= 6:
		if len(s2) + len(s3) > 0:
			print('YES')
			continue
		else:
			print('NO')
			continue
	if len(s2) + len(s3) > 1:
		print('YES')
		continue
	else:
		print('NO')
		continue


from collections import Counter
board_count = int(input())
boards = Counter([int(i) for i in input().split()])
event_count = int(input())
sum2 = sum(map(lambda x: x // 2, boards.values()))
sum4 = sum(map(lambda x: x // 4, boards.values()))
for _ in range(event_count):
	event = input().split()
	event_type = event[0]
	board = int(event[1])
	if event_type == '+':
		if board not in boards:
			boards[board] = 1
		else:
			boards[board] += 1
		if boards[board] // 2 != (boards[board] - 1) // 2:
			sum2 += boards[board] // 2 - (boards[board] - 1) // 2
		if boards[board] // 4 != (boards[board] - 1) // 4:
			sum4 += boards[board] // 4 - (boards[board] - 1) // 4
	else:
		boards[board] -= 1
		if boards[board] // 2 != (boards[board] + 1) // 2:
			sum2 -= (boards[board] + 1) // 2 - boards[board] // 2
		if boards[board] // 4 != (boards[board] + 1) // 4:
			sum4 -= (boards[board] + 1) // 4 - boards[board] // 4
	if sum4 >= 1 and sum2 >= 4:
		print('YES')
		continue
	print('NO')


from functools import reduce
import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def inn():
	return int(input())
mo = 1000000007
n = inn()
a = arr()
d = defaultdict(int)
s2 = 0
s4 = 0
for i in a:
	s2 -= d[i] // 2
	s4 -= d[i] // 4
	d[i] += 1
	s2 += d[i] // 2
	s4 += d[i] // 4
for _ in range(int(input())):
	s = [str(x) for x in input().split()]
	i = int(s[1])
	s2 -= d[i] // 2
	s4 -= d[i] // 4
	if s[0] == '+':
		d[i] += 1
	else:
		d[i] -= 1
	s2 += d[i] // 2
	s4 += d[i] // 4
	if s2 >= 4 and s4 >= 1:
		print('YES')
	else:
		print('NO')


import sys
from collections import defaultdict
read = lambda : sys.stdin.readline().strip()

def fun():
	d = defaultdict(int)
	n = int(read())
	nums = list(map(int, read().split()))
	for i in nums:
		d[i] += 1
	(cnt2, cnt4) = (0, 0)
	for cnt in d.values():
		cnt2 += cnt // 2
		cnt4 += cnt // 4
	for _ in range(int(read())):
		(sign, q) = read().split()
		q = int(q)
		cnt2 -= d[q] // 2
		cnt4 -= d[q] // 4
		if sign == '+':
			d[q] += 1
		else:
			d[q] -= 1
		cnt2 += d[q] // 2
		cnt4 += d[q] // 4
		if cnt2 >= 4 and cnt4 >= 1:
			print('YES')
		else:
			print('NO')
fun()


from sys import stdin
input = stdin.readline
input()
(*a,) = list(map(int, input().split()))
(s, r) = [0] * 2
cnt = [0] * 100002
for i in a:
	cnt[i] += 1
	if cnt[i] % 4 == 0:
		s += 1
	if cnt[i] % 2 == 0:
		r += 1
q = int(input())
for i in range(q):
	(sign, n) = input().split()
	n = int(n)
	if sign == '+':
		cnt[n] += 1
		if cnt[n] % 4 == 0:
			s += 1
		if cnt[n] % 2 == 0:
			r += 1
	elif sign == '-':
		if cnt[n] % 4 == 0:
			s -= 1
		if cnt[n] % 2 == 0:
			r -= 1
		cnt[n] -= 1
	print('YES' if s > 1 or (s == 1 and r > 3) else 'NO')


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
rw = lambda : sys.stdin.readline().strip().split()
ri = lambda : int(sys.stdin.readline().strip())
rs = lambda : sys.stdin.readline().strip()
from collections import defaultdict as df
from math import *
n = ri()
cnt = df(int)
dcnt = df(int)
g2 = 0
g4 = 0
l = RI()
for a in l:
	cnt[a] += 1
	if cnt[a] == 4:
		g4 += 1
		g2 -= 1
	elif cnt[a] == 2:
		g2 += 1
	elif cnt[a] % 2 == 0:
		g2 += 1
q = ri()
for j in range(q):
	l = rw()
	l[1] = int(l[1])
	if l[0] == '+':
		a = l[1]
		cnt[a] += 1
		if cnt[a] == 4:
			g4 += 1
			g2 -= 1
		elif cnt[a] == 2:
			g2 += 1
		elif cnt[a] % 2 == 0:
			g2 += 1
	else:
		a = l[1]
		cnt[a] -= 1
		if cnt[a] == 3:
			g4 -= 1
			g2 += 1
		elif cnt[a] == 1:
			g2 -= 1
		elif (cnt[a] + 1) % 2 == 0:
			g2 -= 1
	if g4 > 1:
		print('YES')
	elif g4 == 1 and g2 > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
x = int(input())
b = [0] * 100001
k = 0
t = 0
for i in arr:
	b[i] += 1
for e in b:
	k = k + e // 2
	t = t + e // 4
for j in range(x):
	(c, d) = map(str, input().split())
	d = int(d)
	k = k - b[d] // 2
	t = t - b[d] // 4
	if c == '+':
		b[d] = b[d] + 1
	else:
		b[d] = b[d] - 1
	k += b[d] // 2
	t += b[d] // 4
	if t > 0 and k > 3:
		print('YES')
	else:
		print('NO')


from sys import stdin
input = stdin.readline
n = int(input())
a = [int(x) for x in input().split()]
b = [0] * 100010
s = [0] * 10
for x in a:
	b[x] += 1
	if b[x] == 8:
		s[6] -= 1
		s[8] += 1
	elif b[x] == 6:
		s[4] -= 1
		s[6] += 1
	elif b[x] == 4:
		s[2] -= 1
		s[4] += 1
	elif b[x] == 2:
		s[0] -= 1
		s[2] += 1
	elif b[x] == 1:
		s[0] += 1
for _ in range(int(input())):
	(c, x) = input().rstrip().split()
	x = int(x)
	if c == '+':
		b[x] += 1
		if b[x] == 8:
			s[6] -= 1
			s[8] += 1
		elif b[x] == 6:
			s[4] -= 1
			s[6] += 1
		elif b[x] == 4:
			s[2] -= 1
			s[4] += 1
		elif b[x] == 2:
			s[0] -= 1
			s[2] += 1
		elif b[x] == 1:
			s[0] += 1
	else:
		b[x] -= 1
		if b[x] == 7:
			s[8] -= 1
			s[6] += 1
		elif b[x] == 5:
			s[6] -= 1
			s[4] += 1
		elif b[x] == 3:
			s[4] -= 1
			s[2] += 1
		elif b[x] == 1:
			s[2] -= 1
			s[0] += 1
		elif b[x] == 0:
			s[0] -= 1
	if s[8] or s[6] > 1:
		print('YES')
	elif s[6] and (s[4] or s[2]):
		print('YES')
	elif s[4] >= 2:
		print('YES')
	elif s[4] and s[2] >= 2:
		print('YES')
	else:
		print('NO')


import os, sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict

def main():
	n = int(input())
	a = Counter(map(int, input().split()))
	freq = defaultdict(set)
	for i in a:
		freq[a[i]].add(i)
	g2 = g4 = g6 = g8 = 0
	for i in freq:
		if i >= 8:
			g8 += len(freq[i])
		if i >= 6:
			g6 += len(freq[i])
		if i >= 4:
			g4 += len(freq[i])
		if i >= 2:
			g2 += len(freq[i])
	for _ in range(int(input())):
		(sy, x) = input().split()
		x = int(x)
		if sy == '+':
			if a[x]:
				freq[a[x]].remove(x)
			a[x] += 1
			freq[a[x]].add(x)
			if a[x] == 8:
				g8 += 1
			elif a[x] == 6:
				g6 += 1
			elif a[x] == 4:
				g4 += 1
			elif a[x] == 2:
				g2 += 1
		else:
			freq[a[x]].remove(x)
			a[x] -= 1
			if a[x]:
				freq[a[x]].add(x)
			if a[x] == 7:
				g8 -= 1
			elif a[x] == 5:
				g6 -= 1
			elif a[x] == 3:
				g4 -= 1
			elif a[x] == 1:
				g2 -= 1
		if g8 or (g6 and g2 >= 2) or g4 >= 2 or (g4 and g2 >= 3):
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
a = list(map(int, input().split()))
two = set()
four = set()
six = set()
eight = set()
count = [0 for i in range(10 ** 5 + 1)]
for i in range(n):
	count[a[i]] += 1
	if count[a[i]] == 2:
		two.add(a[i])
	if count[a[i]] == 4:
		four.add(a[i])
		two.remove(a[i])
	if count[a[i]] == 6:
		six.add(a[i])
		four.remove(a[i])
	if count[a[i]] == 8:
		eight.add(a[i])
		six.remove(a[i])
q = int(input())
for i in range(q):
	(c, m) = input().split()
	m = int(m)
	if c == '+':
		count[m] += 1
		if count[m] == 4:
			four.add(m)
			two.remove(m)
		if count[m] == 2:
			two.add(m)
		if count[m] == 6:
			six.add(m)
			four.remove(m)
		if count[m] == 8:
			eight.add(m)
			six.remove(m)
	else:
		count[m] -= 1
		if count[m] == 7:
			eight.remove(m)
			six.add(m)
		if count[m] == 5:
			six.remove(m)
			four.add(m)
		if count[m] == 3:
			four.remove(m)
			two.add(m)
		if count[m] == 1:
			two.remove(m)
	if len(eight) >= 1:
		print('YES')
	elif len(six) >= 1 and (len(four) >= 1 or len(two) >= 1):
		print('YES')
	elif len(four) >= 2:
		print('YES')
	elif len(four) >= 1 and len(two) >= 2:
		print('YES')
	elif len(six) >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
ware = {}
pairs = 0
pair = {}
sq = 0
re = 0
for i in range(n):
	ware[arr[i]] = ware.get(arr[i], 0) + 1
	if ware[arr[i]] == 2:
		ware[arr[i]] = 0
		pair[arr[i]] = pair.get(arr[i], 0) + 1
		pairs += 1
q = int(input())
for _ in range(q):
	(s, a) = input().split()
	a = int(a)
	if s == '+':
		ware[a] = ware.get(a, 0) + 1
		if ware[a] == 2:
			ware[a] = 0
			pair[a] = pair.get(a, 0) + 1
			pairs += 1
	elif ware[a] == 0:
		ware[a] = 1
		pair[a] -= 1
		pairs -= 1
		if pair[a] == 0:
			del pair[a]
	else:
		ware[a] -= 1
	if pairs >= 4 and len(pair) < pairs:
		print('YES')
	else:
		print('NO')


n = int(input())
x = input()
a = []
a = x.split(' ')
c = {}
for i in range(n):
	a[i] = int(a[i])
	if a[i] not in c:
		c[a[i]] = 1
	else:
		c[a[i]] += 1
(c4, c2, c8, c6) = (0, 0, 0, 0)
for k in c.keys():
	if c[k] >= 8:
		c8 += 1
	elif c[k] >= 6:
		c6 += 1
	elif c[k] >= 4:
		c4 += 1
	elif c[k] >= 2:
		c2 += 1
q = int(input())
for i in range(q):
	z = input()
	(s, x) = z.split(' ')
	x = int(x)
	if s == '+':
		if x not in c:
			c[x] = 1
		else:
			c[x] += 1
			if c[x] == 8:
				c8 += 1
				c6 -= 1
				if c6 == -1:
					c6 += 1
			elif c[x] == 6:
				c6 += 1
				c4 -= 1
				if c4 == -1:
					c4 += 1
			elif c[x] == 4:
				c4 += 1
				c2 -= 1
				if c2 == -1:
					c2 += 1
			elif c[x] == 2:
				c2 += 1
	else:
		c[x] -= 1
		if c[x] == -1:
			c[x] += 1
		if c[x] == 1:
			c2 -= 1
			if c2 == -1:
				c2 += 1
		elif c[x] == 3:
			c4 -= 1
			c2 += 1
			if c4 == -1:
				c4 += 1
		elif c[x] == 5:
			c6 -= 1
			c4 += 1
			if c6 == -1:
				c6 += 1
		elif c[x] == 7:
			c8 -= 1
			c6 += 1
			if c8 == -1:
				c8 += 1
	if c8 >= 1 or (c4 >= 1 and c2 >= 2) or (c6 >= 1 and c2 >= 1) or (c6 >= 1 and c4 >= 1) or (c4 >= 2) or (c6 >= 1 and c2 >= 2) or (c6 >= 2):
		print('YES')
	else:
		print('NO')


import sys
n = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
q = int(sys.stdin.readline())
twos = {}
fours = {}
eights = {}
sixs = {}
freq = {}
for num in A:
	freq[num] = freq.get(num, 0) + 1
	if freq[num] == 2:
		twos[num] = True
	if freq[num] == 4:
		fours[num] = True
		del twos[num]
	if freq[num] == 6:
		sixs[num] = True
		del fours[num]
	if freq[num] == 8:
		eights[num] = True
		del sixs[num]
for _ in range(q):
	query = sys.stdin.readline().split()
	num = int(query[1])
	if query[0] == '+':
		freq[num] = freq.get(num, 0) + 1
		if freq[num] == 2:
			twos[num] = True
		if freq[num] == 4:
			fours[num] = True
			del twos[num]
		if freq[num] == 6:
			sixs[num] = True
			del fours[num]
		if freq[num] == 8:
			eights[num] = True
			del sixs[num]
	else:
		freq[num] = freq.get(num, 0) - 1
		if freq[num] == 1:
			del twos[num]
		if freq[num] == 3:
			del fours[num]
			twos[num] = True
		if freq[num] == 5:
			del sixs[num]
			fours[num] = True
		if freq[num] == 7:
			del eights[num]
			sixs[num] = True
	ans = 'NO'
	if len(eights) > 0:
		ans = 'YES'
	if len(sixs) > 1:
		ans = 'YES'
	if len(sixs) == 1 and (len(fours) > 0 or len(twos) > 0):
		ans = 'YES'
	if len(fours) > 1:
		ans = 'YES'
	if len(fours) == 1 and len(twos) > 1:
		ans = 'YES'
	print(ans)


import collections
n = int(input())
l = [int(i) for i in input().split()]
d = dict(collections.Counter(l))
(c1, c2) = (0, 0)
for i in d:
	c1 += d[i] // 4
	c2 += d[i] // 2
q = int(input())
for w in range(q):
	s = input()
	k = int(s[2:])
	if s[0] == '+':
		if k in d:
			d[k] += 1
			if d[k] % 4 == 0:
				c1 += 1
			if d[k] % 2 == 0:
				c2 += 1
		else:
			d[k] = 1
	else:
		d[k] -= 1
		if d[k] % 4 == 3:
			c1 -= 1
		if d[k] % 2 == 1:
			c2 -= 1
	if c1 >= 2:
		print('YES')
	elif c1 == 0:
		print('NO')
	elif c2 - 2 >= 2:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
N = int(input())
A = input().split()
cnt = defaultdict(int)
for x in A:
	cnt[x] += 1
has_8 = set()
has_6 = set()
has_4 = set()
has_2 = set()
for (k, v) in cnt.items():
	if v >= 8:
		has_8.add(k)
		continue
	if v >= 6:
		has_6.add(k)
		continue
	if v >= 4:
		has_4.add(k)
		continue
	if v >= 2:
		has_2.add(k)
		continue
Q = int(input())
for _ in range(Q):
	(cmd, x) = input().split()
	if cmd == '+':
		if cnt[x] == 7:
			has_8.add(x)
			has_6.remove(x)
		if cnt[x] == 5:
			has_6.add(x)
			has_4.remove(x)
		if cnt[x] == 3:
			has_4.add(x)
			has_2.remove(x)
		if cnt[x] == 1:
			has_2.add(x)
		cnt[x] += 1
	else:
		if cnt[x] == 2:
			has_2.remove(x)
		if cnt[x] == 4:
			has_4.remove(x)
			has_2.add(x)
		if cnt[x] == 6:
			has_6.remove(x)
			has_4.add(x)
		if cnt[x] == 8:
			has_8.remove(x)
			has_6.add(x)
		cnt[x] -= 1
	cond0 = len(has_8) >= 1
	cond1 = len(has_6) >= 2
	cond2 = len(has_6) == 1 and (len(has_4) >= 1 or len(has_2) >= 1)
	cond3 = len(has_4) >= 2
	cond4 = len(has_4) == 1 and len(has_2) >= 2
	if cond0 or cond1 or cond2 or cond3 or cond4:
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
changes = int(input())
d = {}
carre = 0
rect = 0
for el in l:
	if el in d:
		d[el] += 1
	else:
		d[el] = 1
for qtt in d.values():
	carre += qtt // 4
	rect += qtt % 4 // 2
for i in range(changes):
	(op, l) = input().split()
	l = int(l)
	if op == '-':
		d[l] -= 1
		if not (d[l] + 1) % 4:
			carre -= 1
			rect += 1
		elif not (d[l] + 1) % 2:
			rect -= 1
	else:
		if l in d:
			d[l] += 1
		else:
			d[l] = 1
		if not d[l] % 4:
			carre += 1
			rect -= 1
		elif not d[l] % 2:
			rect += 1
	print(['NO', 'YES'][carre >= 1 and rect >= 2 or carre >= 2])


n = int(input())
a = list(map(int, input().split()))
a_dict = {}
for i in a:
	a_dict[i] = a_dict.get(i, 0) + 1
res = {'sqr': 0, 'rect': 0}

def is_good():
	global a_dict, res
	for v in a_dict.values():
		v2 = v // 2
		if v2 >= 2:
			res['sqr'] += 1
			v2 -= 2
		if v2 >= 2:
			res['sqr'] += 1
			v2 -= 2
		if v2 >= 1:
			res['rect'] += 1
			v2 -= 1
q = int(input())
ANS = []
is_good()
for i in range(q):
	(sign, num) = input().split()
	num = int(num)
	if num not in a_dict:
		a_dict[num] = 0
	if sign == '+':
		a_dict[int(num)] += 1
		v = a_dict[int(num)]
		if v % 2 == 0:
			if v % 4 == 0:
				res['sqr'] += 1
				res['rect'] -= 1
			else:
				res['rect'] += 1
	else:
		a_dict[int(num)] -= 1
		v = a_dict[int(num)]
		if (v + 1) % 2 == 0:
			if (v + 1) % 4 == 0:
				res['sqr'] -= 1
				res['rect'] += 1
			else:
				res['rect'] -= 1
	if res['sqr'] >= 1 and res['rect'] >= 2 or res['sqr'] >= 2:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
from math import gcd, sqrt, factorial
from collections import deque
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(x)
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 0 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
n = I()
a = [0] * (10 ** 5 + 7)
d = {2: 0, 4: 0}
for i in R():
	a[i] += 1
for i in a:
	if i >= 4:
		d[4] += i // 4
		if i % 4 >= 2:
			d[2] += 1
	elif i >= 2:
		d[2] += 1
for i in range(I()):
	s = S().split()
	p = int(s[1])
	if s[0] == '+':
		a[p] += 1
		if a[p] == 2:
			d[2] += 1
		elif a[p] == 4:
			d[2] -= 1
			d[4] += 1
		elif a[p] > 4:
			if a[p] % 4 == 0:
				d[4] += 1
				d[2] -= 1
			elif a[p] % 4 == 2:
				d[2] += 1
	else:
		a[p] -= 1
		if a[p] == 1:
			d[2] -= 1
		elif a[p] == 3:
			d[2] += 1
			d[4] -= 1
		elif a[p] >= 4:
			if (a[p] + 1) % 4 == 0:
				d[4] -= 1
				d[2] += 1
			elif a[p] % 2 == 1:
				d[2] -= 1
	if d[2] >= 2 and d[4] >= 1 or d[4] >= 2:
		print('YES')
	else:
		print('NO')


def solve():
	_ = int(input())
	a = list(map(int, input().split()))
	d = {}
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	k = {2: 0, 4: 0}
	for (key, val) in d.items():
		if val >= 4:
			k[4] += 1
			k[2] += (val - 4) // 2
		else:
			k[2] += val // 2
	for _ in range(int(input())):
		(char, key) = input().split()
		key = int(key)
		if char == '+':
			if key not in d:
				d[key] = 1
			else:
				val = d[key]
				if val >= 4:
					k[4] -= 1
					k[2] -= (val - 4) // 2
				else:
					k[2] -= val // 2
				d[key] += 1
				val = d[key]
				if val >= 4:
					k[4] += 1
					k[2] += (val - 4) // 2
				else:
					k[2] += val // 2
		else:
			val = d[key]
			if val >= 4:
				k[4] -= 1
				k[2] -= (val - 4) // 2
			else:
				k[2] -= val // 2
			d[key] -= 1
			val = d[key]
			if val >= 4:
				k[4] += 1
				k[2] += (val - 4) // 2
			else:
				k[2] += val // 2
		if k[4] > 1 or (k[4] == 1 and k[2] > 1):
			print('YES')
		else:
			print('NO')
solve()


n = int(input())
a = list(map(int, input().split()))
t = int(input())
s = [0] * (10 ** 5 + 5)
two = 0
four = 0
lol = 0
for i in a:
	s[i] += 1
	lol = s[i]
	if lol == 2:
		two += 1
	elif lol == 4:
		two -= 1
		four += 1
	elif lol == 6:
		two += 1
	elif lol == 8:
		two += 1
for _ in range(t):
	(d, q) = input().split()
	q = int(q)
	if d == '-':
		s[q] -= 1
		lol = s[q]
		if lol == 1:
			two -= 1
		elif lol == 3:
			two += 1
			four -= 1
		elif lol == 5:
			two -= 1
		elif lol == 7:
			two -= 1
	else:
		s[q] += 1
		lol = s[q]
		if lol == 2:
			two += 1
		elif lol == 4:
			two -= 1
			four += 1
		elif lol == 6:
			two += 1
		elif lol == 8:
			two += 1
	if four == 1 and two >= 2 or four > 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict as dd
n = int(input())
a = list(map(int, input().split()))
d = dd(int)
for i in a:
	d[i] += 1
ctr = 0
cts = 0
st = list(set(a))
for i in st:
	cts += d[i] // 4
	ctr += d[i] // 2
q = int(input())
for _ in range(q):
	s = input().split()
	if s[0] == '+':
		si = int(s[1])
		d[si] += 1
		if d[si] % 4 == 0:
			cts += 1
		if d[si] % 2 == 0:
			ctr += 1
		if ctr >= 4 and cts > 0:
			print('YES')
		else:
			print('NO')
	else:
		si = int(s[1])
		d[si] -= 1
		if d[si] % 4 == 3:
			cts -= 1
		if d[si] % 2 == 1:
			ctr -= 1
		if ctr >= 4 and cts > 0:
			print('YES')
		else:
			print('NO')


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
c = Counter(a)
d = {2: {}, 4: {}}
for i in c:
	if c[i] >= 4:
		d[4][i] = 0
	elif c[i] >= 2:
		d[2][i] = 0
for i in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		if b in c:
			c[b] += 1
		else:
			c[b] = 1
		if c[b] == 4:
			d[4][b] = 0
			del d[2][b]
		elif c[b] == 2:
			d[2][b] = 0
	else:
		c[b] -= 1
		if c[b] == 3:
			del d[4][b]
			d[2][b] = 0
		elif c[b] == 1:
			del d[2][b]
	if len(d[4]) >= 2:
		print('YES')
	elif len(d[4]) == 1 and len(d[2]) >= 2:
		print('YES')
	elif len(d[4]) == 1:
		for k in d[4]:
			ind = k
			break
		if len(d[2]) == 1 and c[ind] >= 6:
			print('YES')
		elif len(d[2]) == 0 and c[ind] >= 8:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from collections import Counter
from collections import OrderedDict
from collections import defaultdict
n = int(input())
arr = [int(x) for x in input().split()]
c2 = 0
c4 = 0
fre = defaultdict(lambda : 0)
for each in arr:
	fre[each] += 1
for each in fre.values():
	c2 += each // 2
	c4 += each // 4
for _ in range(int(input())):
	(ty, val) = input().split()
	val = int(val)
	if ty == '+':
		c2 -= fre[val] // 2
		c4 -= fre[val] // 4
		fre[val] += 1
		c2 += fre[val] // 2
		c4 += fre[val] // 4
	else:
		c2 -= fre[val] // 2
		c4 -= fre[val] // 4
		fre[val] -= 1
		c2 += fre[val] // 2
		c4 += fre[val] // 4
	if c4 >= 1 and c2 - 2 >= 2:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
p = list(map(int, input().split()))
dd = defaultdict(lambda : 0)
co = defaultdict(lambda : 0)
for i in p:
	co[i] += 1
	x = co[i]
	dd[x] += 1
for _ in range(int(input())):
	(inp, nt) = input().split()
	pa = int(nt)
	if inp == '+':
		co[pa] += 1
		x = co[pa]
		dd[x] += 1
	else:
		x = co[pa]
		co[pa] -= 1
		dd[x] -= 1
	if dd[4] >= 2:
		print('YES')
	elif dd[8] > 0:
		print('YES')
	elif dd[6] > 0 and dd[2] > 1:
		print('YES')
	elif dd[4] >= 1 and dd[2] >= 3:
		print('YES')
	else:
		print('NO')


number_of = [0] * 100001
n = int(input())
P = list(map(int, input().split()))
for p in P:
	number_of[p - 1] += 1
four_plus = 0
two_plus = 0
for n in number_of:
	four_plus += n // 4
	two_plus += n // 2
q = int(input())
for i in range(q):
	s = input()
	lumber_size = int(s.split()[-1]) - 1
	if s.split()[0] == '-':
		number_of[lumber_size] -= 1
		n = number_of[lumber_size]
		if n % 4 == 3:
			four_plus -= 1
		if n % 2 == 1:
			two_plus -= 1
	elif s.split()[0] == '+':
		number_of[lumber_size] += 1
		n = number_of[lumber_size]
		if n % 4 == 0:
			four_plus += 1
		if n % 2 == 0:
			two_plus += 1
	if four_plus >= 1 and two_plus >= 4:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
spc = {2: 0, 4: 0, 6: 0, 8: 0}

def handle(is_plus, x):
	if is_plus:
		counts[x] += 1
		for v in [2, 4, 6, 8]:
			if counts[x] == v:
				spc[v] += 1
	else:
		counts[x] -= 1
		for v in [2, 4, 6, 8]:
			if counts[x] == v - 1:
				spc[v] -= 1
n = int(input())
counts = defaultdict(int)
a = list(map(int, input().split()))
for x in a:
	handle(True, x)
q = int(input())
for _ in range(q):
	(c, x) = input().split()
	x = int(x)
	handle(c == '+', x)
	if spc[8] >= 1:
		print('YES')
	elif spc[6] >= 1 and spc[2] >= 2:
		print('YES')
	elif spc[4] >= 2:
		print('YES')
	elif spc[4] >= 1 and spc[2] >= 3:
		print('YES')
	else:
		print('NO')


from collections import Counter
import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(val + '\n')

def prog():
	n = int(input())
	gt2 = 0
	gt4 = 0
	gt6 = 0
	gt8 = 0
	length_freq = [0] * (10 ** 5 + 1)
	lengths = Counter(list(map(int, input().split())))
	for length in lengths:
		length_freq[length] = lengths[length]
		if lengths[length] >= 2:
			gt2 += 1
		if lengths[length] >= 4:
			gt4 += 1
		if lengths[length] >= 6:
			gt6 += 1
		if lengths[length] >= 8:
			gt8 += 1
	q = int(input())
	for i in range(q):
		query = input().split()
		length = int(query[1])
		if query[0] == '+':
			length_freq[length] += 1
			if length_freq[length] == 2:
				gt2 += 1
			elif length_freq[length] == 4:
				gt4 += 1
			elif length_freq[length] == 6:
				gt6 += 1
			elif length_freq[length] == 8:
				gt8 += 1
		else:
			length_freq[length] -= 1
			if length_freq[length] == 1:
				gt2 -= 1
			elif length_freq[length] == 3:
				gt4 -= 1
			elif length_freq[length] == 5:
				gt6 -= 1
			elif length_freq[length] == 7:
				gt8 -= 1
		if gt8 >= 1 or gt4 >= 2 or (gt4 >= 1 and gt2 >= 3) or (gt6 >= 1 and gt2 >= 2):
			print('YES')
		else:
			print('NO')
prog()


from collections import Counter

def ip():
	return int(input())

def sip():
	return input()

def mip():
	return map(int, input().split())

def mips():
	return map(str, input().split())

def lip():
	return list(map(int, input().split()))

def matip(n, m):
	lst = []
	for i in range(n):
		arr = lip()
		lst.append(arr)
	return lst
n = ip()
arr = lip()
count = dict(Counter(arr))
two = 0
four = 0
for i in count.values():
	two += i // 2
	four += i // 4
t = ip()
while t:
	t -= 1
	(p, s) = mips()
	s = int(s)
	if p == '+':
		if s in count:
			count[s] += 1
		else:
			count[s] = 1
		if count[s] % 2 == 0:
			two += 1
		if count[s] % 4 == 0:
			four += 1
	else:
		if count[s] % 2 == 0:
			two -= 1
		if count[s] % 4 == 0:
			four -= 1
		count[s] -= 1
	if two >= 4 and four >= 1:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
for i in a:
	d[i] += 1
four_s = 0
two_s = 0
for i in d:
	if d[i] >= 4:
		four_s += d[i] // 4
		two_s += d[i] % 4 // 2
	else:
		two_s += d[i] // 2
q = int(input())
for _ in range(q):
	(t, l) = input().split()
	l = int(l)
	if t == '+':
		d[l] += 1
		if d[l] % 4 == 0:
			two_s -= 1
			four_s += 1
		elif d[l] % 2 == 0:
			two_s += 1
	else:
		d[l] -= 1
		if (d[l] + 1) % 4 == 0:
			four_s -= 1
			two_s += 1
		elif (d[l] + 1) % 2 == 0:
			two_s -= 1
	if four_s >= 2 or (four_s >= 1 and two_s >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
array = list(map(int, input().split(' ')))
count = []
for x in range(100001):
	count.append(0)
for x in array:
	count[x] += 1
c2 = 0
c4 = 0
c6 = 0
c8 = 0
for x in range(100001):
	if count[x] >= 2:
		c2 += 1
	if count[x] >= 6:
		c6 += 1
	if count[x] >= 4:
		c4 += 1
	if count[x] >= 8:
		c8 += 1
q = int(input())

def res(a, b, c, d):
	if d > 0:
		return 'YES'
	if c > 0 and a > 1:
		return 'YES'
	if b > 1:
		return 'YES'
	if b == 1 and a > 2:
		return 'YES'
	return 'NO'
for event in range(q):
	(c, x) = input().split(' ')
	x = int(x)
	if c == '+':
		count[x] += 1
		if count[x] == 2:
			c2 += 1
		if count[x] == 4:
			c4 += 1
		if count[x] == 8:
			c8 += 1
		if count[x] == 6:
			c6 += 1
	else:
		count[x] -= 1
		if count[x] == 1:
			c2 -= 1
		if count[x] == 3:
			c4 -= 1
		if count[x] == 7:
			c8 -= 1
		if count[x] == 5:
			c6 -= 1
	print(res(c2, c4, c6, c8))


from collections import *
import sys
from bisect import *

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
n = ri()
aa = rl()
q = ri()
cnt = Counter(aa)
cnt_min = [0] * (n + q + 9)
cnt_copy = defaultdict(int)
for key in cnt:
	for i in range(cnt[key] + 1):
		cnt_min[i] += 1
		cnt_copy[key] = cnt[key]
for _ in range(q):
	line = input().split()
	if line[0] == '+':
		cnt_copy[int(line[1])] += 1
		cnt_min[cnt_copy[int(line[1])]] += 1
	else:
		cnt_min[cnt_copy[int(line[1])]] -= 1
		cnt_copy[int(line[1])] -= 1
	if cnt_min[8] >= 1:
		print('YES')
		continue
	if cnt_min[4] >= 2:
		print('YES')
		continue
	if cnt_min[6] >= 1 and cnt_min[2] >= 2:
		print('YES')
		continue
	if cnt_min[4] >= 1 and cnt_min[2] >= 3:
		print('YES')
		continue
	print('NO')


import sys
import math
import copy
import heapq
from functools import cmp_to_key
from bisect import bisect_left, bisect_right
from collections import defaultdict, deque, Counter
input = sys.stdin.readline
getS = lambda : input().strip()
getN = lambda : int(input())
getList = lambda : list(map(int, input().split()))
getZList = lambda : [int(x) - 1 for x in input().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
divide = lambda x: pow(x, MOD - 2, MOD)

def nck(n, k, kaijyo):
	return npk(n, k, kaijyo) * divide(kaijyo[k]) % MOD

def npk(n, k, kaijyo):
	if k == 0 or k == n:
		return n % MOD
	return kaijyo[n] * divide(kaijyo[n - k]) % MOD

def fact_and_inv(SIZE):
	inv = [0] * SIZE
	fac = [0] * SIZE
	finv = [0] * SIZE
	inv[1] = 1
	fac[0] = fac[1] = 1
	finv[0] = finv[1] = 1
	for i in range(2, SIZE):
		inv[i] = MOD - MOD // i * inv[MOD % i] % MOD
		fac[i] = fac[i - 1] * i % MOD
		finv[i] = finv[i - 1] * inv[i] % MOD
	return (fac, finv)

def renritsu(A, Y):
	A = np.matrix(A)
	Y = np.matrix(Y)
	Y = np.reshape(Y, (-1, 1))
	X = np.linalg.solve(A, Y)
	return X.flatten().tolist()[0]

class TwoDimGrid:

	def __init__(self, h, w, wall='#'):
		self.h = h
		self.w = w
		self.size = (h + 2) * (w + 2)
		self.wall = wall
		self.get_grid()

	def get_grid(self):
		grid = [self.wall * (self.w + 2)]
		for i in range(self.h):
			grid.append(self.wall + getS() + self.wall)
		grid.append(self.wall * (self.w + 2))
		self.grid = grid

	def init_cost(self):
		self.cost = [INF] * self.size

	def pos(self, x, y):
		return y * (self.w + 2) + x

	def getgrid(self, x, y):
		return self.grid[y][x]

	def get(self, x, y):
		return self.cost[self.pos(x, y)]

	def set(self, x, y, v):
		self.cost[self.pos(x, y)] = v
		return

	def show(self):
		for i in range(self.h + 2):
			print(self.cost[(self.w + 2) * i:(self.w + 2) * (i + 1)])

	def showsome(self, tgt):
		for t in tgt:
			print(t)
		return

	def showsomejoin(self, tgt):
		for t in tgt:
			print(''.join(t))
		return

	def search(self):
		grid = self.grid
		move = [(0, 1), (0, -1), (1, 0), (-1, 0)]
		move_eight = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]

def solve():
	n = getN()
	nums = getList()
	cnt = Counter(nums)
	m = getN()
	(ei, si, fo, tw) = (0, 0, 0, 0)
	for v in cnt.values():
		if v >= 8:
			ei += 1
		elif v >= 6:
			si += 1
		elif v >= 4:
			fo += 1
		elif v >= 2:
			tw += 1
	for i in range(m):
		(q, v) = getS().split()
		v = int(v)
		if q == '+':
			if v not in cnt:
				cnt[v] = 1
			else:
				cnt[v] += 1
				if cnt[v] == 8:
					ei += 1
					si -= 1
				elif cnt[v] == 6:
					si += 1
					fo -= 1
				elif cnt[v] == 4:
					fo += 1
					tw -= 1
				elif cnt[v] == 2:
					tw += 1
		else:
			cnt[v] -= 1
			if cnt[v] == 7:
				ei -= 1
				si += 1
			elif cnt[v] == 5:
				si -= 1
				fo += 1
			elif cnt[v] == 3:
				fo -= 1
				tw += 1
			elif cnt[v] == 1:
				tw -= 1
		if ei >= 1:
			print('YES')
		elif si >= 1 and max(ei, si - 1, fo, tw) >= 1:
			print('YES')
		elif fo >= 2:
			print('YES')
		elif fo >= 1 and tw >= 2:
			print('YES')
		else:
			print('NO')

def main():
	n = getN()
	for _ in range(n):
		solve()
	return
solve()


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
(n,) = Neo()
A = Neo()
d = Counter(A)
(a, r) = (0, 0)
for i in d.values():
	a += i // 4
	r += i // 2
(q,) = Neo()
for i in range(q):
	(p, q) = input().split()
	q = int(q)
	if p == '+':
		a -= d[q] // 4
		r -= d[q] // 2
		d[q] += 1
		a += d[q] // 4
		r += d[q] // 2
	else:
		a -= d[q] // 4
		r -= d[q] // 2
		d[q] -= 1
		a += d[q] // 4
		r += d[q] // 2
	if a > 1 or (a == 1 and r > 3):
		print('YES')
	else:
		print('NO')


import sys, math
input = sys.stdin.readline
n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
	try:
		d[i] += 1
	except:
		d[i] = 1
countFour = 0
countTwo = 0
countSix = 0
countEight = 0
for i in d:
	if d[i] >= 8:
		countEight += 1
	if d[i] >= 6:
		countSix += 1
	if d[i] >= 4:
		countFour += 1
	if d[i] >= 2:
		countTwo += 1
Q = int(input())
for q in range(Q):
	s = input().strip('\n')
	l = s.split(' ')
	i = int(l[1])
	if l[0] == '+':
		try:
			d[i] += 1
		except:
			d[i] = 1
		if d[i] == 8:
			countEight += 1
		if d[i] == 6:
			countSix += 1
		if d[i] == 4:
			countFour += 1
		if d[i] == 2:
			countTwo += 1
	else:
		if d[i] == 8:
			countEight -= 1
		if d[i] == 6:
			countSix -= 1
		if d[i] == 4:
			countFour -= 1
		if d[i] == 2:
			countTwo -= 1
		d[i] -= 1
	flag = False
	if countFour >= 2 or (countFour >= 1 and countTwo >= 3) or countEight >= 1 or (countSix >= 1 and countTwo >= 2):
		flag = True
	if flag:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
t = {}
for i in c:
	t[c[i]] = t.get(c[i], 0) + 1
for q in range(int(input())):
	(f, x) = input().split()
	x = int(x)
	t[c[x]] = t.get(c[x], 0) - 1
	if f == '-':
		c[x] -= 1
	if f == '+':
		c[x] += 1
	t[c[x]] = t.get(c[x], 0) + 1
	r1 = False
	r2 = 0
	for i in sorted(t):
		if i >= 4:
			if t[i] >= 1:
				if not r1:
					r2 += (i * t[i] - 4) // 2
				else:
					r2 += i * t[i] // 2
				r1 = True
		elif i >= 2:
			r2 += t[i]
	if r1 and r2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
m = list(map(int, input().split()))
from collections import Counter
d = Counter(m)
t = 0
f = 0
s = 0
e = 0
for i in d:
	if d[i] >= 8:
		e += 1
	elif d[i] >= 6:
		s += 1
	elif d[i] >= 4:
		f += 1
	elif d[i] >= 2:
		t += 1
for x in range(int(input())):
	c = input().split()
	if c[0] == '+':
		k = int(c[1])
		d[k] += 1
		if d[k] == 6:
			s += 1
			f -= 1
		elif d[k] == 2:
			t += 1
		elif d[k] == 4:
			t -= 1
			f += 1
		elif d[k] == 8:
			s -= 1
			e += 1
	else:
		k = int(c[1])
		if d[k] == 2:
			t -= 1
		elif d[k] == 4:
			t += 1
			f -= 1
		elif d[k] == 6:
			s -= 1
			f += 1
		elif d[k] == 8:
			e -= 1
			s += 1
		d[k] -= 1
	if e > 0:
		print('YES')
	elif f >= 2:
		print('YES')
	elif s > 0 and s + t + f >= 2:
		print('YES')
	elif s == 0 and (f > 0 and f + t >= 3):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
ans = []
n = int(input())
a = list(map(int, input().split()))
freq = [0] * 100001
(c2, c4, c6, c8) = (0, 0, 0, 0)
for k in a:
	freq[k] += 1
	if freq[k] == 2:
		c2 += 1
	elif freq[k] == 4:
		c2 -= 1
		c4 += 1
	elif freq[k] == 6:
		c4 -= 1
		c6 += 1
	elif freq[k] == 8:
		c6 -= 1
		c8 += 1
q = int(input())
for _ in range(q):
	(s, k_str) = input().split()
	k = int(k_str)
	if s == '+':
		freq[k] += 1
		if freq[k] == 2:
			c2 += 1
		elif freq[k] == 4:
			c2 -= 1
			c4 += 1
		elif freq[k] == 6:
			c4 -= 1
			c6 += 1
		elif freq[k] == 8:
			c6 -= 1
			c8 += 1
	else:
		freq[k] -= 1
		if freq[k] == 1:
			c2 -= 1
		elif freq[k] == 3:
			c4 -= 1
			c2 += 1
		elif freq[k] == 5:
			c6 -= 1
			c4 += 1
		elif freq[k] == 7:
			c8 -= 1
			c6 += 1
	if c8 >= 1 or c4 + c6 >= 2 or (c4 >= 1 and c2 >= 2) or (c6 >= 1 and c2 >= 1):
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')

def add(dp, dpC, v):
	dp[v] += 1
	if dp[v] % 2 == 0:
		dpC[2] += 1
	if dp[v] % 4 == 0:
		dpC[4] += 1

def remove(dp, dpC, v):
	dp[v] -= 1
	if dp[v] % 2 == 1:
		dpC[2] -= 1
	if dp[v] % 4 == 3:
		dpC[4] -= 1

def chackAnswer(dpC):
	if dpC[4] < 1:
		return 'NO'
	elif dpC[4] >= 2:
		return 'YES'
	elif dpC[2] >= 4:
		return 'YES'
	else:
		return 'NO'
n = int(input())
ar = list(map(int, input().split()))
dp = [0] * 1000005
dpC = [0] * 5
for i in range(n):
	dpC[0] += 1
	add(dp, dpC, ar[i])
for q in range(int(input())):
	(z, v) = map(str, input().split())
	v = int(v)
	if z == '+':
		add(dp, dpC, v)
	else:
		remove(dp, dpC, v)
	print(chackAnswer(dpC))
sys.exit(0)


import io, os
from collections import deque
import bisect
RL = lambda : list(map(int, input().split(' ')))
n = int(input())
l = RL()
dic = [0] * (10 ** 5 + 1)
for i in range(n):
	dic[l[i]] += 1
twos = 0
fours = 0
for i in range(10 ** 5 + 1):
	twos += dic[i] // 2
	fours += dic[i] // 4
q = int(input())
for i in range(q):
	s = input()
	t = s[0]
	num = int(s[1:])
	if t == '+':
		if dic[num] // 4 != (dic[num] + 1) // 4:
			fours += 1
		if dic[num] % 2:
			twos += 1
		dic[num] += 1
	else:
		if dic[num] // 4 != (dic[num] - 1) // 4:
			fours -= 1
		if dic[num] % 2 == 0:
			twos -= 1
		dic[num] -= 1
	if fours > 0 and twos - 2 >= 2:
		print('YES')
	else:
		print('NO')


import sys

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def rinput():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))
mod = int(1000000000.0) + 7
n = iinput()
l = get_list()
a = [0] * 100002
b = [0] * 100002
for item in l:
	a[item] += 1
	b[a[item]] += 1
q = iinput()
for _ in range(q):
	s = input()
	k = int(s[2:])
	if s[0] == '+':
		a[k] += 1
		b[a[k]] += 1
	else:
		b[a[k]] -= 1
		a[k] -= 1
	if b[2] > 1 and b[6] > 0 or b[4] > 1 or (b[4] > 0 and b[2] > 2) or (b[8] > 0):
		print('YES')
	else:
		print('NO')


t = int(input())
num = list(map(int, input().split(' ')))
q = int(input())
cum_dict = {}
var0 = 0
var1 = 0
var2 = 0
var3 = 0
var4 = 0
count_dict = {}
for i in num:
	if i not in count_dict.keys():
		count_dict[i] = 1
		var0 += 1
	elif count_dict[i] == 1:
		var0 -= 1
		var1 += 1
		count_dict[i] += 1
	elif count_dict[i] == 2:
		count_dict[i] += 1
	elif count_dict[i] == 3:
		var1 -= 1
		var2 += 1
		count_dict[i] += 1
	elif count_dict[i] == 4:
		count_dict[i] += 1
	elif count_dict[i] == 5:
		var2 -= 1
		var3 += 1
		count_dict[i] += 1
	elif count_dict[i] == 6:
		count_dict[i] += 1
	elif count_dict[i] == 7:
		var3 -= 1
		var4 += 1
		count_dict[i] += 1
	else:
		count_dict[i] += 1
for _ in range(q):
	tmp_str = input().split(' ')
	i = int(tmp_str[1])
	if tmp_str[0] == '+':
		if i not in count_dict.keys():
			count_dict[i] = 1
			var0 += 1
		elif count_dict[i] == 1:
			var0 -= 1
			var1 += 1
			count_dict[i] += 1
		elif count_dict[i] == 2:
			count_dict[i] += 1
		elif count_dict[i] == 3:
			var1 -= 1
			var2 += 1
			count_dict[i] += 1
		elif count_dict[i] == 4:
			count_dict[i] += 1
		elif count_dict[i] == 5:
			var2 -= 1
			var3 += 1
			count_dict[i] += 1
		elif count_dict[i] == 6:
			count_dict[i] += 1
		elif count_dict[i] == 7:
			var3 -= 1
			var4 += 1
			count_dict[i] += 1
		else:
			count_dict[i] += 1
	elif count_dict[i] == 1:
		count_dict[i] -= 1
	elif count_dict[i] == 2:
		var0 += 1
		var1 -= 1
		count_dict[i] -= 1
	elif count_dict[i] == 3:
		count_dict[i] -= 1
	elif count_dict[i] == 4:
		var1 += 1
		var2 -= 1
		count_dict[i] -= 1
	elif count_dict[i] == 5:
		count_dict[i] -= 1
	elif count_dict[i] == 6:
		var2 += 1
		var3 -= 1
		count_dict[i] -= 1
	elif count_dict[i] == 7:
		count_dict[i] -= 1
	elif count_dict[i] == 8:
		var3 += 1
		var4 -= 1
		count_dict[i] -= 1
	else:
		count_dict[i] -= 1
	if var4 >= 1 or var3 >= 2 or var2 >= 2:
		print('YES')
	elif var3 >= 1 and (var1 >= 1 or var2 >= 1):
		print('YES')
	elif var2 >= 1 and var1 >= 2:
		print('YES')
	else:
		print('NO')


import sys
import math
from math import *
from collections import defaultdict
import os
from io import BytesIO, IOBase
from collections import deque
import bisect

def main():
	n = int(input())
	arr = list(map(int, input().split()))
	d = defaultdict(lambda : 0)
	fr = tw = 0
	for i in arr:
		d[i] += 1
		if d[i] % 4 == 0:
			fr += 1
			tw -= 1
		if d[i] % 4 == 2:
			tw += 1
	t = int(input())
	for i in range(t):
		l = input().split()
		a = int(l[1])
		if l[0] == '+':
			d[a] += 1
			if d[a] % 4 == 0:
				fr += 1
				tw -= 1
			if d[a] % 4 == 2:
				tw += 1
		else:
			d[a] -= 1
			if d[a] % 4 == 3:
				fr -= 1
				tw += 1
			if d[a] % 4 == 1:
				tw -= 1
		if fr >= 2:
			print('YES')
		elif fr >= 1 and tw >= 2:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
arr = list(map(int, input().split()))
ct = dict()
for k in arr:
	if k not in ct:
		ct[k] = 0
	ct[k] += 1
fr = 0
tw = 0
for i in ct:
	fr += ct[i] // 4
	tw += ct[i] % 4 // 2
t = int(input())
for i in range(t):
	p = input()
	if p[0] == '+':
		k = int(p[1:])
		if k not in ct:
			ct[k] = 1
		else:
			r = ct[k] // 4
			w = ct[k] % 4 // 2
			ct[k] += 1
			if ct[k] // 4 > r:
				fr += 1
			if ct[k] % 4 // 2 > w:
				tw += 1
			if ct[k] // 4 < r:
				fr -= 1
			if ct[k] % 4 // 2 < w:
				tw -= 1
	else:
		k = int(p[1:])
		r = ct[k] // 4
		w = ct[k] % 4 // 2
		ct[k] -= 1
		if ct[k] // 4 < r:
			fr -= 1
		if ct[k] % 4 // 2 < w:
			tw -= 1
		if ct[k] // 4 > r:
			fr += 1
		if ct[k] % 4 // 2 > w:
			tw += 1
	if fr >= 2:
		print('YES')
	elif fr >= 1 and tw >= 2:
		print('YES')
	else:
		print('NO')


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

def sain():
	return input().split()

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	s = set()
	for p in range(2, n + 1):
		if prime[p]:
			s.add(p)
	return s

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	n = iin()
	l = ain()
	d = [0] * (10 ** 5 + 1)
	c = {4: 0, 2: 0}
	for i in l:
		d[i] += 1
	for i in range(1, 10 ** 5 + 1):
		kk = d[i]
		c[4] += kk // 4
		kk %= 4
		c[2] += kk // 2
	for _ in range(iin()):
		(a, x) = sain()
		x = int(x)
		c[4] -= d[x] // 4
		k = d[x] % 4
		c[2] -= k // 2
		if a == '+':
			d[x] += 1
		else:
			d[x] -= 1
		k = d[x]
		c[4] += k // 4
		k %= 4
		c[2] += k // 2
		if c[4] > 1 or (c[4] == 1 and c[2] > 1):
			print('YES')
		else:
			print('NO')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


n = int(input())
a = {}
c2 = 0
c4 = 0
for x in input().split():
	x = int(x)
	if x in a:
		a[x] += 1
	else:
		a[x] = 1
for key in a:
	c2 += a[key] // 2
	c4 += a[key] // 4
q = int(input())
while q:
	(sign, number) = map(str, input().split())
	number = int(number)
	if sign == '+':
		if number in a:
			a[number] += 1
		else:
			a[number] = 1
		if a[number] % 2 == 0:
			c2 += 1
		if a[number] % 4 == 0:
			c4 += 1
	else:
		if a[number] % 2 == 0:
			c2 -= 1
		if a[number] % 4 == 0:
			c4 -= 1
		a[number] -= 1
	if c4 >= 2 or (c4 == 1 and c2 >= 4):
		print('YES')
	else:
		print('NO')
	q -= 1


import itertools
import sys
input = sys.stdin.readline

def countstrs(s):
	return [(k, len(list(g))) for (k, g) in itertools.groupby(s)]
from pprint import pprint
import sys
import collections
import heapq
d1 = dict()
d2 = dict()
d3 = dict()
d4 = dict()
n = int(input())
dat = list(map(int, input().split()))
dat.sort()
l = countstrs(dat)
buf = []
for i in range(len(l)):
	(a, b) = l[i]
	if b >= 4:
		d4[a] = b
		continue
	if b == 3:
		d3[a] = b
		continue
	if b == 2:
		d2[a] = b
		continue
	if b == 1:
		d1[a] = b
		continue
q = int(input())
for _ in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		if b in d4:
			d4[b] += 1
		elif b in d3:
			del d3[b]
			d4[b] = 4
		elif b in d2:
			del d2[b]
			d3[b] = 3
		elif b in d1:
			del d1[b]
			d2[b] = 2
		else:
			d1[b] = 1
	elif b in d4:
		t = d4[b]
		if t == 4:
			del d4[b]
			d3[b] = 3
		else:
			d4[b] -= 1
	elif b in d3:
		del d3[b]
		d2[b] = 2
	elif b in d2:
		del d2[b]
		d1[b] = 1
	elif b in d1:
		del d1[b]
	if len(d4) == 0:
		print('NO')
		continue
	if len(d4) > 1:
		print('YES')
		continue
	k = list(d4.keys())
	x = d4[k[0]]
	x -= 4
	more = 2
	if x >= 4:
		print('YES')
		continue
	if x >= 2:
		more = 1
	if len(d3) + len(d2) >= more:
		print('YES')
		continue
	print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = [int(item) for item in input().split()]
q = int(input())
cnt = [0] * (10 ** 5 + 1)
for item in a:
	cnt[item] += 1
pair = 0
square = 0
for (i, item) in enumerate(cnt):
	pair += item // 2
	square += item // 4
for _ in range(q):
	(sign, num) = input().split()
	num = int(num)
	if sign == '+':
		cnt[num] += 1
		if cnt[num] % 2 == 0:
			pair += 1
		if cnt[num] % 4 == 0:
			square += 1
	else:
		if cnt[num] % 2 == 0:
			pair -= 1
		if cnt[num] % 4 == 0:
			square -= 1
		cnt[num] -= 1
	if square > 0 and pair > 3:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import deque as que, defaultdict as vector
from bisect import bisect as bsearch
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))
inst = lambda : input()
INF = float('inf')
_T_ = 1
for _t_ in range(_T_):
	fse = 0
	tse = 0
	cnt = vector(int)
	n = inin()
	a = inar()
	for i in a:
		cnt[i] += 1
		if cnt[i] == 2:
			tse += 1
		if cnt[i] == 4:
			tse -= 1
			fse += 1
			cnt[i] -= 4
	q = inin()
	for _ in range(q):
		(p, q) = inst().split()
		q = int(q)
		if p == '+':
			cnt[q] += 1
			if cnt[q] == 2:
				tse += 1
			if cnt[q] == 4:
				tse -= 1
				fse += 1
				cnt[q] -= 4
		if p == '-':
			if cnt[q] == 0:
				tse += 1
				cnt[q] = 3
				fse -= 1
			else:
				cnt[q] -= 1
				if cnt[q] == 1:
					tse -= 1
		if tse >= 2 and fse >= 1 or fse >= 2:
			print('YES')
		else:
			print('NO')


maxN = 100000.0 + 5
a = [0] * int(maxN)
cnt = [0] * int(maxN)
n = int(input())
x = [int(item) for item in input().split()]
for i in range(n):
	a[x[i]] += 1
	cnt[a[x[i]]] += 1
q = int(input())
for i in range(q):
	t = [item for item in input().split()]
	c = t[0]
	x = int(t[1])
	if c == '+':
		a[x] += 1
		cnt[a[x]] += 1
	else:
		cnt[a[x]] -= 1
		a[x] -= 1
	if cnt[8] > 0 or cnt[4] >= 2 or (cnt[6] > 0 and cnt[2] >= 2) or (cnt[4] > 0 and cnt[2] >= 3):
		print('YES')
	else:
		print('NO')


from collections import Counter
total = int(input())
counts = [0] * 100001
ns = [0] * 10
for v in map(int, input().split()):
	if counts[v] in set([1, 3, 5, 7]):
		ns[counts[v] + 1] += 1
	counts[v] += 1
for _ in range(int(input())):
	s = input()
	sign = s[0]
	num = int(s[2:])
	if sign == '+':
		if counts[num] in set([1, 3, 5, 7]):
			ns[counts[num] + 1] += 1
		counts[num] += 1
	else:
		if counts[num] in set([2, 4, 6, 8]):
			ns[counts[num]] -= 1
		counts[num] -= 1
	res = 'NO'
	if ns[8] >= 1:
		res = 'YES'
	elif ns[6] >= 1 and ns[2] >= 2:
		res = 'YES'
	elif ns[4] >= 2:
		res = 'YES'
	elif ns[4] >= 1 and ns[2] >= 3:
		res = 'YES'
	print(res)


from collections import Counter
import os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
a = Counter(map(int, input().split()))
q = int(input())
(n2, n4, n6, n8) = (0, 0, 0, 0)
for i in a.values():
	if i >= 2:
		n2 += 1
	if i >= 4:
		n4 += 1
	if i >= 6:
		n6 += 1
	if i >= 8:
		n8 += 1
for _ in range(q):
	(s, k) = input().split()
	k = int(k)
	s = s.decode()
	if s == '+':
		if k not in a:
			a[k] = 0
		a[k] += 1
		if a[k] == 2:
			n2 += 1
		elif a[k] == 4:
			n4 += 1
		elif a[k] == 6:
			n6 += 1
		elif a[k] == 8:
			n8 += 1
	else:
		a[k] -= 1
		if a[k] == 1:
			n2 -= 1
		elif a[k] == 3:
			n4 -= 1
		elif a[k] == 5:
			n6 -= 1
		elif a[k] == 7:
			n8 -= 1
	if n8 > 0 or n6 > 1 or (n6 == 1 and n2 > 1) or (n4 > 1) or (n4 == 1 and n2 > 2):
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
numcnt = [0] * (10 ** 5 + 1)
(o, e) = (0, 0)
b = 0
for i in a:
	numcnt[i] += 1
for i in numcnt:
	b += i // 4
	e += i // 2
q = int(input())
for _ in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		numcnt[y] += 1
		if numcnt[y] % 4 == 0:
			b += 1
		if numcnt[y] % 2 == 0:
			e += 1
	else:
		numcnt[y] -= 1
		if numcnt[y] % 4 == 3:
			b -= 1
		if numcnt[y] % 2 == 1:
			e -= 1
	print('YES' if b >= 2 or (b == 1 and e >= 4) else 'NO')


from collections import Counter
from collections import defaultdict
from bisect import bisect_left

def solve(eight, six, four, two):
	if eight >= 1:
		return True
	elif four >= 2:
		return True
	elif six >= 1 and two >= 2:
		return True
	elif four >= 1 and two >= 3:
		return True
	else:
		return False
_ = int(input())
c = Counter(list(map(int, input().split())))
d = defaultdict(int)
for (k, v) in c.items():
	d[k] = v
arr = list(d.values())
arr.sort()
length = len(arr)
eight = length - bisect_left(arr, 8)
six = length - bisect_left(arr, 6)
four = length - bisect_left(arr, 4)
two = length - bisect_left(arr, 2)
n = int(input())
for _ in range(n):
	(x, y) = map(str, input().split())
	if x == '+':
		d[int(y)] += 1
		if d[int(y)] == 2:
			two += 1
		if d[int(y)] == 4:
			four += 1
		if d[int(y)] == 6:
			six += 1
		if d[int(y)] == 8:
			eight += 1
	else:
		d[int(y)] -= 1
		if d[int(y)] == 1:
			two -= 1
		if d[int(y)] == 3:
			four -= 1
		if d[int(y)] == 5:
			six -= 1
		if d[int(y)] == 7:
			eight -= 1
	print('YES' if solve(eight, six, four, two) else 'NO')


import sys
n = int(sys.stdin.readline())
arr = list(map(int, input().split()))
di = {}
count2 = 0
count4 = 0
for i in arr:
	if i in di:
		di[i] += 1
		if di[i] % 4 != 0 and di[i] % 2 == 0:
			count2 += 1
		if di[i] % 4 == 0:
			count4 += 1
			count2 -= 1
	else:
		di[i] = 1
arr.clear()
no = int(sys.stdin.readline())
for i in range(no):
	(s, o) = input().split()
	o = int(o)
	if s == '-':
		if di[o] % 4 == 0:
			count4 -= 1
			count2 += 1
		elif di[o] % 2 == 0 and di[o] % 4 != 0:
			count2 -= 1
		di[o] -= 1
	else:
		if o not in di:
			di[o] = 0
		di[o] += 1
		if di[o] % 4 != 0 and di[o] % 2 == 0:
			count2 += 1
		if di[o] % 4 == 0:
			count4 += 1
			count2 -= 1
	if count4 >= 2 or (count4 >= 1 and count2 >= 2):
		print('YES')
	else:
		print('NO')


import sys
import heapq, functools, collections
import math, random
from collections import Counter, defaultdict

def solve(lst, queries):
	console('----- solving ------')
	console(lst)
	console(queries)
	c = Counter(lst)
	counts = [0 for _ in range(9)]
	for (k, v) in c.items():
		if v > 8:
			v = 8
		counts[v] += 1
	console(counts)
	for (a, b) in queries:
		cur = c[b]
		if a == '+':
			c[b] += 1
		if a == '-':
			c[b] -= 1
		new = c[b]
		if cur > 8:
			cur = 8
		if new > 8:
			new = 8
		counts[cur] -= 1
		counts[new] += 1
		console(counts)
		if sum(counts[8:]) >= 1:
			print('YES')
			continue
		if sum(counts[6:]) >= 1 and sum(counts[2:]) >= 2:
			print('YES')
			continue
		if sum(counts[4:]) >= 2:
			print('YES')
			continue
		if sum(counts[4:]) >= 1 and sum(counts[2:]) >= 3:
			print('YES')
			continue
		print('NO')
	return

def console(*args):
	print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)
	return
lines = sys.stdin.readlines()
lst = list(map(int, lines[1].split()))
num_queries = int(lines[2])
grid = [x.split() for x in lines[3:3 + num_queries]]
grid = [(str(a), int(b)) for (a, b) in grid]
solve(lst, grid)


from collections import Counter
n = int(input())
a = [int(s) for s in input().split(' ')]
q = int(input())
sides = 0
counter = Counter(a)
square = 0
for count in counter:
	sides += counter[count] - counter[count] % 2
	square += counter[count] // 4
for _ in range(q):
	event = input().split(' ')
	count = int(event[1])
	if event[0] == '+':
		counter[count] += 1
		if counter[count] % 2 == 0:
			sides += 2
		if counter[count] % 4 == 0:
			square += 1
	else:
		counter[count] -= 1
		if counter[count] % 2 == 1:
			sides -= 2
		if counter[count] % 4 == 3:
			square -= 1
	if sides >= 8 and square > 0:
		print('YES')
	else:
		print('NO')


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
from io import BytesIO, IOBase

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(n4, n2) = (0, 0)
freq = defaultdict(int)

def add(x):
	global n2, n4
	freq[x] += 1
	if freq[x] % 2 == 0:
		n2 += 1
	if freq[x] % 4 == 0:
		n4 += 1

def sub(x):
	global n2, n4
	old = freq[x]
	freq[x] -= 1
	if old % 2 == 0:
		n2 -= 1
	if old % 4 == 0:
		n4 -= 1
N = int(fast())
for x in zzz():
	add(x)
Q = int(fast())
for _ in range(Q):
	(t, x) = fast().split(' ')
	x = int(x)
	if t == '+':
		add(x)
	else:
		sub(x)
	print('YES' if n4 >= 1 and n2 - 2 >= 2 else 'NO')


from collections import defaultdict as dc
vis = dc(lambda : 0)
x = int(input())
s = list(map(int, input().split()))
for n in s:
	vis[n] += 1
tws = 0
fors = 0
six = 0
eight = 0
for n in vis:
	if vis[n] >= 8:
		eight += 1
	elif vis[n] >= 6:
		six += 1
	elif vis[n] >= 4:
		fors += 1
	elif vis[n] >= 2:
		tws += 1
j = int(input())
for n in range(j):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		vis[b] += 1
		if vis[b] == 8:
			eight += 1
			six -= 1
		elif vis[b] == 6:
			six += 1
			fors -= 1
		elif vis[b] == 4:
			fors += 1
			tws -= 1
		elif vis[b] == 2:
			tws += 1
	else:
		vis[b] -= 1
		if vis[b] == 7:
			eight -= 1
			six += 1
		elif vis[b] == 5:
			six -= 1
			fors += 1
		elif vis[b] == 3:
			fors -= 1
			tws += 1
		elif vis[b] == 1:
			tws -= 1
	if eight:
		print('YES')
		continue
	if fors >= 2 or six >= 2:
		print('YES')
		continue
	if six and (fors or tws):
		print('YES')
		continue
	if fors and tws >= 2:
		print('YES')
		continue
	print('NO')


from sys import stdin, stdout
from collections import Counter

def shift_down(i):
	n = len(heap)
	while 2 * i + 1 < n:
		maxm = 2 * i + 1
		if 2 * i + 2 < n and count[heap[2 * i + 2]] > count[heap[2 * i + 1]]:
			maxm = 2 * i + 2
		if count[heap[maxm]] <= count[heap[i]]:
			return
		(index[heap[maxm]], index[heap[i]]) = (i, maxm)
		(heap[maxm], heap[i]) = (heap[i], heap[maxm])
		i = maxm

def shift_up(i):
	while (i - 1) // 2 >= 0 and count[heap[(i - 1) // 2]] < count[heap[i]]:
		(index[heap[(i - 1) // 2]], index[heap[i]]) = (i, (i - 1) // 2)
		(heap[(i - 1) // 2], heap[i]) = (heap[i], heap[(i - 1) // 2])
		i = (i - 1) // 2

def check():
	i = 0
	n = len(heap)
	while 2 * i + 1 < n:
		maxm = 2 * i + 1
		minm = 2 * i + 2
		if 2 * i + 2 < n and count[heap[2 * i + 2]] > count[heap[2 * i + 1]]:
			(maxm, minm) = (minm, maxm)
		if count[heap[maxm]] < 2:
			return
		if count[heap[maxm]] >= 2:
			condn.append(True)
		if count[heap[maxm]] >= 4:
			condn.append(True)
		if minm < n and count[heap[minm]] >= 2:
			condn.append(True)
		if len(condn) >= 2:
			return
		i = maxm
outputs = []
N = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().strip().split()))
count = Counter(arr)
q = int(stdin.readline().strip())
heap = list(count.keys())
index = {}
for i in range(len(heap)):
	index[heap[i]] = i
for i in range((len(heap) - 1) // 2, -1, -1):
	shift_down(i)
for __ in range(q):
	(op, x) = stdin.readline().strip().split()
	if op == '+':
		if count.get(int(x), -1) == -1:
			count[int(x)] = 1
			index[int(x)] = len(heap)
			heap.append(int(x))
			shift_up(len(heap) - 1)
		else:
			count[int(x)] += 1
			shift_up(index[int(x)])
	else:
		count[int(x)] -= 1
		shift_down(index[int(x)])
	if count[heap[0]] < 4:
		outputs.append('NO')
	elif count[heap[0]] - 4 >= 4:
		outputs.append('YES')
	else:
		condn = []
		if count[heap[0]] - 4 >= 2:
			condn.append(True)
		check()
		if len(condn) < 2:
			outputs.append('NO')
		else:
			outputs.append('YES')
for output in outputs:
	stdout.write(output + '\n')


from sys import stdin, stdout
a = int(stdin.readline())
st = [0] * 9
pl = [0] * 100001

def inc(x):
	global pl, st
	if pl[x] < 8:
		st[pl[x]] -= 1
		st[pl[x] + 1] += 1
	pl[x] += 1

def dec(x):
	global pl, st
	if pl[x] <= 8:
		st[pl[x]] -= 1
		st[pl[x] - 1] += 1
	pl[x] -= 1
for i in map(int, input().split()):
	inc(i)
k = int(stdin.readline())
for _ in ' ' * k:
	(u, v) = input().split()
	if u == '+':
		inc(int(v))
	else:
		dec(int(v))
	if st[8] or sum(st[4:8]) > 1 or (sum(st[2:4]) > 1 and sum(st[4:6])) or (sum(st[2:4]) and sum(st[6:8])) or (sum(st[4:8]) > 2):
		print('YES')
	else:
		print('NO')


def typ(x):
	global dic
	if dic[x] == 2 or dic[x] == 3:
		return 2
	elif dic[x] >= 4:
		return 4
	else:
		return 0

def rep(x):
	global dic, two, four, c1, c2
	if typ(x) == 2:
		if not x in two:
			if x in four:
				c1 += 1
				c2 -= 1
				four.remove(x)
				two.add(x)
			else:
				two.add(x)
				c1 += 1
	elif typ(x) == 4:
		if not x in four:
			if x in two:
				c1 -= 1
				c2 += 1
				four.add(x)
				two.remove(x)
			else:
				c2 += 1
				four.add(x)
	elif x in two:
		c1 -= 1
		two.remove(x)
n = int(input())
ar = list(map(int, input().split()))
dic = {}
for i in range(n):
	if ar[i] in dic:
		dic[ar[i]] += 1
	else:
		dic[ar[i]] = 1
two = set({})
c1 = 0
four = set({})
c2 = 0
for i in dic:
	rep(i)
for _ in range(int(input())):
	(si, el) = map(str, input().split())
	el = int(el)
	if si == '+':
		dic[el] = dic.get(el, 0) + 1
		rep(el)
	elif si == '-':
		dic[el] -= 1
		rep(el)
	if c2 >= 2:
		print('YES')
	elif c2 == 0:
		print('NO')
	else:
		for k in four:
			break
		if dic[k] >= 8:
			print('YES')
		elif dic[k] >= 6:
			if c1 >= 1:
				print('YES')
			else:
				print('NO')
		elif c1 >= 2:
			print('YES')
		else:
			print('NO')


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
x = 0
y = 0
for i in c:
	x += c[i] // 4
	y += c[i] // 2
q = int(input())
for _ in range(q):
	s = input()
	dt = int(s[1:])
	if s[0] == '+':
		x -= c[dt] // 4
		y -= c[dt] // 2
		c[dt] += 1
		x += c[dt] // 4
		y += c[dt] // 2
	else:
		x -= c[dt] // 4
		y -= c[dt] // 2
		c[dt] -= 1
		x += c[dt] // 4
		y += c[dt] // 2
	if x >= 1 and y >= 4:
		print('YES')
	else:
		print('NO')


class SegTree:

	def __init__(self, init_val, n, ide_ele, seg_func):
		self.segfunc = seg_func
		self.num = 2 ** (n - 1).bit_length()
		self.ide_ele = ide_ele
		self.seg = [self.ide_ele] * 2 * self.num
		for i in range(n):
			self.seg[i + self.num - 1] = init_val[i]
		for i in range(self.num - 2, -1, -1):
			self.seg[i] = self.segfunc(self.seg[2 * i + 1], self.seg[2 * i + 2])

	def update(self, k, x):
		k += self.num - 1
		self.seg[k] = (self.seg[k][0], self.seg[k][1] + x)
		while k + 1:
			k = (k - 1) // 2
			self.seg[k] = self.segfunc(self.seg[k * 2 + 1], self.seg[k * 2 + 2])

	def query(self, p, q):
		if q <= p:
			return self.ide_ele
		p += self.num - 1
		q += self.num - 2
		res = self.ide_ele
		while q - p > 1:
			if p & 1 == 0:
				res = self.segfunc(res, self.seg[p])
			if q & 1 == 1:
				res = self.segfunc(res, self.seg[q])
				q -= 1
			p = p // 2
			q = (q - 1) // 2
		if p == q:
			res = self.segfunc(res, self.seg[p])
		else:
			res = self.segfunc(self.segfunc(res, self.seg[p]), self.seg[q])
		return res

def maxt(a, b):
	if a[1] > b[1]:
		return a
	else:
		return b
import sys
input = sys.stdin.readline
(N,) = map(int, input().split())
X = list(map(int, input().split()))
nn = 10 ** 5 + 1
ss = SegTree([(i, 0) for i in range(nn)], nn, (-1, -1), maxt)
for x in X:
	ss.update(x, 1)
(Q,) = map(int, input().split())
for _ in range(Q):
	(t, x) = input().strip().split()
	x = int(x)
	if t == '+':
		ss.update(x, 1)
	else:
		ss.update(x, -1)
	(c, x) = ss.query(0, nn)
	if x >= 8:
		print('YES')
	elif x >= 6:
		ss.update(c, -6)
		(c2, x2) = ss.query(0, nn)
		if x2 >= 2:
			print('YES')
		else:
			print('NO')
		ss.update(c, 6)
	elif x >= 4:
		ss.update(c, -4)
		(c2, x2) = ss.query(0, nn)
		if x2 >= 4:
			print('YES')
		elif x2 >= 2:
			ss.update(c2, -2)
			(c3, x3) = ss.query(0, nn)
			if x3 >= 2:
				print('YES')
			else:
				print('NO')
			ss.update(c2, 2)
		else:
			print('NO')
		ss.update(c, 4)
	else:
		print('NO')


n = int(input())
c = [0] * (10 ** 5 + 1)
c4 = 0
c2 = 0
a = list(map(int, input().split()))
for i in a:
	c2 -= c[i] // 2
	c4 -= c[i] // 4
	c[i] += 1
	c2 += c[i] // 2
	c4 += c[i] // 4
q = int(input())
for i in range(q):
	(s, x) = input().split()
	c2 -= c[int(x)] // 2
	c4 -= c[int(x)] // 4
	if s == '+':
		c[int(x)] += 1
	else:
		c[int(x)] -= 1
	c2 += c[int(x)] // 2
	c4 += c[int(x)] // 4
	if c4 >= 1 and c2 >= 4:
		print('YES')
	else:
		print('NO')


N = int(input())
planks = [int(x) for x in input().split()]
d = {}
anything_num = 0
two_num = 0
for p in planks:
	d[p] = d.get(p, 0) + 1
	if d[p] == 8:
		anything_num += 1
		two_num -= 1
	if d[p] == 6:
		two_num += 1
	if d[p] == 4:
		anything_num += 1
		two_num -= 1
	if d[p] == 2:
		two_num += 1
Q = int(input())
for _ in range(Q):
	(ev, plank) = input().split()
	plank = int(plank)
	if ev == '+':
		d[plank] = d.get(plank, 0) + 1
		if d[plank] == 8:
			anything_num += 1
			two_num -= 1
		if d[plank] == 6:
			two_num += 1
		if d[plank] == 4:
			anything_num += 1
			two_num -= 1
		if d[plank] == 2:
			two_num += 1
	else:
		d[plank] -= 1
		if d[plank] == 7:
			anything_num -= 1
			two_num += 1
		if d[plank] == 5:
			two_num -= 1
		if d[plank] == 3:
			anything_num -= 1
			two_num += 1
		if d[plank] == 1:
			two_num -= 1
	ans = anything_num >= 2 or (anything_num == 1 and two_num >= 2)
	if ans:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
b = list(map(int, input().split()))
d = defaultdict(lambda : 0)
lsq = 0
lrect = 0
lhe = 0
loct = 0
for j in range(n):
	d[b[j]] += 1
	if d[b[j]] == 4:
		lsq += 1
	if d[b[j]] == 2:
		lrect += 1
	if d[b[j]] == 6:
		lhe += 1
	if d[b[j]] == 8:
		loct += 1
q = int(input())
for j in range(q):
	c = list(map(str, input().split()))
	(y, z) = (c[0], int(c[1]))
	if y == '+':
		if d[z] == 1:
			lrect += 1
		elif d[z] == 3:
			lsq += 1
		elif d[z] == 5:
			lhe += 1
		elif d[z] == 7:
			loct += 1
		d[z] += 1
		if loct == 1:
			print('YES')
		elif lsq >= 2:
			print('YES')
		elif lhe == 1 and lrect > 1:
			print('YES')
		elif lhe == 0 and lsq > 0 and (lrect > 2):
			print('YES')
		else:
			print('NO')
	else:
		if d[z] == 2:
			lrect -= 1
		elif d[z] == 4:
			lsq -= 1
		elif d[z] == 6:
			lhe -= 1
		elif d[z] == 8:
			loct -= 1
		d[z] -= 1
		if loct >= 1:
			print('YES')
		elif lsq >= 2:
			print('YES')
		elif lhe == 1 and lrect > 1:
			print('YES')
		elif lhe == 0 and lsq > 0 and (lrect > 2):
			print('YES')
		else:
			print('NO')


n = int(input())
a = [int(x) for x in input().split(' ')]
q = int(input())
ops = []
freq = {}
for aa in a:
	if aa not in freq:
		freq[aa] = 1
	else:
		freq[aa] += 1
freq_count = {}
for i in range(100001):
	freq_count[i] = 0
for f in freq.values():
	freq_count[f] += 1
total = len(a)
for i in range(q):
	x = input()
	num = int(x[2:])
	if x[0] == '+':
		total += 1
		if num not in freq:
			freq[num] = 1
			freq_count[1] += 1
		else:
			freq_count[freq[num]] -= 1
			freq[num] += 1
			freq_count[freq[num]] += 1
	else:
		total -= 1
		freq_count[freq[num]] -= 1
		freq[num] -= 1
		freq_count[freq[num]] += 1
	total_till_7 = 0
	for k in [1, 2, 3, 4, 5, 6, 7]:
		total_till_7 += k * freq_count[k]
	total_till_3 = 0
	for k in [1, 2, 3]:
		total_till_3 += k * freq_count[k]
	if total > total_till_7:
		print('YES')
		continue
	if total > total_till_3:
		c1 = freq_count[2] + freq_count[3]
		c2 = freq_count[4] + freq_count[5]
		c3 = freq_count[6] + freq_count[7]
		if c3 + c2 >= 2 or (c3 >= 1 and c1 + c2 >= 1) or c1 >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
dic = {}
arr = list(map(int, input().split()))
dicf = {8: 0, 6: 0, 4: 0, 2: 0}
for i in arr:
	try:
		if dic[i] == 7:
			dicf[8] += 1
		elif dic[i] == 5:
			dicf[6] += 1
		elif dic[i] == 3:
			dicf[4] += 1
		elif dic[i] == 1:
			dicf[2] += 1
		dic[i] += 1
	except:
		dic[i] = 1
for _ in range(int(input())):
	(v, x) = map(str, input().split())
	x = int(x)
	if v == '+':
		try:
			if dic[x] == 7:
				dicf[8] += 1
			elif dic[x] == 5:
				dicf[6] += 1
			elif dic[x] == 3:
				dicf[4] += 1
			elif dic[x] == 1:
				dicf[2] += 1
			dic[int(x)] += 1
		except:
			dic[int(x)] = 1
	else:
		if dic[x] == 8:
			dicf[8] -= 1
		elif dic[x] == 6:
			dicf[6] -= 1
		elif dic[x] == 4:
			dicf[4] -= 1
		elif dic[x] == 2:
			dicf[2] -= 1
		dic[int(x)] -= 1
	s = False
	r = False
	rs = 0
	if dicf[8] > 0:
		s = True
		r = True
	elif dicf[6] > 0 and dicf[2] > 1:
		s = True
		r = True
	elif dicf[4] > 1:
		s = True
		r = True
	elif dicf[4] > 0 and dicf[2] > 2:
		s = True
		r = True
	if r and s:
		print('YES')
	else:
		print('NO')


def get_ints():
	return list(map(int, list(input().split())))

def get_int():
	return int(input())
n = get_int()
counts = {}
num_4 = 0
pairs = 0

def add_plank(plank):
	global num_4, pairs
	if plank in counts:
		counts[plank] += 1
		if counts[plank] == 4:
			num_4 += 1
		if counts[plank] % 2 == 0:
			pairs += 1
	else:
		counts[plank] = 1
for plank in get_ints():
	add_plank(plank)
q = get_int()
for zzz in range(q):
	query = input().split()
	num = int(query[1])
	if query[0] == '+':
		add_plank(num)
	else:
		counts[num] -= 1
		if counts[num] == 3:
			num_4 -= 1
		if counts[num] % 2 == 1:
			pairs -= 1
	if num_4 > 0 and pairs - 2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [int(p) for p in input().split()]
q = int(input())
cnt4 = 0
cnt2 = 0
counter = [0] * (10 ** 5 + 1)
for i in range(len(arr)):
	cnt4 -= counter[arr[i]] // 4
	cnt2 -= counter[arr[i]] // 2
	counter[arr[i]] += 1
	cnt4 += counter[arr[i]] // 4
	cnt2 += counter[arr[i]] // 2
for i in range(q):
	(t, v) = input().split()
	v = int(v)
	cnt4 -= counter[v] // 4
	cnt2 -= counter[v] // 2
	if t == '+':
		counter[v] += 1
	else:
		counter[v] -= 1
	cnt4 += counter[v] // 4
	cnt2 += counter[v] // 2
	if cnt4 >= 1 and cnt2 >= 4:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [int(x) for x in input().split()]
dic = {}
(sqSet, recSet, bothSet) = (set(), set(), set())
for i in arr:
	dic[i] = dic.get(i, 0) + 1
	val = dic[i]
	if i in sqSet:
		sqSet.remove(i)
	if i in recSet:
		recSet.remove(i)
	if i in bothSet:
		bothSet.remove(i)
	if val >= 8:
		bothSet.add(i)
	elif val >= 6:
		sqSet.add(i)
		recSet.add(i)
	elif val >= 4:
		sqSet.add(i)
	elif val >= 2:
		recSet.add(i)
q = int(input())
for i in range(q):
	(sym, i) = [x for x in input().split()]
	i = int(i)
	if i in sqSet:
		sqSet.remove(i)
	if i in recSet:
		recSet.remove(i)
	if i in bothSet:
		bothSet.remove(i)
	if sym == '+':
		dic[i] = dic.get(i, 0) + 1
	else:
		dic[i] -= 1
	val = dic[i]
	if val >= 8:
		bothSet.add(i)
	elif val >= 6:
		sqSet.add(i)
		recSet.add(i)
	elif val >= 4:
		sqSet.add(i)
	elif val >= 2:
		recSet.add(i)
	if len(bothSet) > 0 or len(sqSet) > 1 or (len(sqSet) > 0 and len(recSet) > 1):
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
storehouse = {}
for plank in a:
	if plank not in storehouse:
		storehouse[plank] = 1
	else:
		storehouse[plank] += 1
(two, four, six, eight) = (0, 0, 0, 0)
for plank in storehouse:
	if storehouse[plank] == 2 or storehouse[plank] == 3:
		two += 1
	elif storehouse[plank] == 4 or storehouse[plank] == 5:
		four += 1
	elif storehouse[plank] == 6 or storehouse[plank] == 7:
		six += 1
	elif storehouse[plank] >= 8:
		eight += 1
for event in range(q):
	description = input().split()
	if description[0] == '+':
		if int(description[1]) not in storehouse:
			storehouse[int(description[1])] = 1
		else:
			storehouse[int(description[1])] += 1
		if storehouse[int(description[1])] == 2:
			two += 1
		elif storehouse[int(description[1])] == 4:
			two -= 1
			four += 1
		elif storehouse[int(description[1])] == 6:
			four -= 1
			six += 1
		elif storehouse[int(description[1])] == 8:
			six -= 1
			eight += 1
	else:
		storehouse[int(description[1])] -= 1
		if storehouse[int(description[1])] == 1:
			two -= 1
		elif storehouse[int(description[1])] == 3:
			two += 1
			four -= 1
		elif storehouse[int(description[1])] == 5:
			four += 1
			six -= 1
		elif storehouse[int(description[1])] == 7:
			six += 1
			eight -= 1
	if eight > 0 or six > 1 or four > 1:
		print('YES')
	elif six == 1 and four == 1 or (six == 1 and two > 0) or (four == 1 and two > 1):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
counter = dict()
n2 = 0
n4 = 0
for i in range(n):
	if arr[i] not in counter.keys():
		counter[arr[i]] = 1
		n2 += counter[arr[i]] // 2
		n4 += counter[arr[i]] // 4
	else:
		n2 -= counter[arr[i]] // 2
		n4 -= counter[arr[i]] // 4
		counter[arr[i]] += 1
		n2 += counter[arr[i]] // 2
		n4 += counter[arr[i]] // 4
m = int(input())
for i in range(m):
	(sign, diff) = input().split()
	if sign == '+':
		num = int(diff)
		if num not in counter.keys():
			counter[num] = 1
			n2 += counter[num] // 2
			n4 += counter[num] // 4
		else:
			n2 -= counter[num] // 2
			n4 -= counter[num] // 4
			counter[num] += 1
			n2 += counter[num] // 2
			n4 += counter[num] // 4
		n += 1
	if sign == '-':
		num = int(diff)
		n2 -= counter[num] // 2
		n4 -= counter[num] // 4
		counter[num] -= 1
		n2 += counter[num] // 2
		n4 += counter[num] // 4
		n -= 1
	if n < 8:
		print('NO')
	elif n4 >= 1 and n2 >= 4:
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
w = [int(k) for k in input().split()]
q = int(input())
(x, y) = (0, 0)
c = Counter(w)
for j in c.keys():
	if c[j] >= 4:
		x += 1
		y += (c[j] - 4) // 2
	if 2 <= c[j] < 4:
		y += 1
for i in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		c[b] += 1
		if c[b] == 4:
			x += 1
			y -= 1
		if c[b] == 2:
			y += 1
		if c[b] % 2 == 0 and c[b] > 4:
			y += 1
	else:
		c[b] -= 1
		if c[b] == 1:
			y -= 1
		if c[b] == 3:
			x -= 1
			y += 1
		if c[b] % 2 == 1 and c[b] > 4:
			y -= 1
	if x >= 2 or (x == 1 and y >= 2):
		print('YES')
	else:
		print('NO')


from collections import Counter
import io
import os
from math import ceil, sqrt

def main():
	n = int(input())
	a = list(map(int, input().split()))
	q = int(input())
	b = Counter(a)
	c = [0] * 9
	for i in b:
		if b[i] < 8:
			c[b[i]] += 1
		else:
			c[-1] += 1
	ans = 'NO'
	if c[8] >= 1 or c[4] >= 2 or c[5] >= 2 or (c[6] >= 2) or (c[7] >= 2) or (c[7] >= 1 and (c[4] >= 1 or c[5] >= 1 or c[6] >= 1)) or (c[6] >= 1 and (c[5] >= 1 or c[4] >= 1)) or (c[5] >= 1 and c[4] >= 1) or ((c[4] == 1 or c[5] == 1 or c[6] == 1 or (c[7] == 1)) and ((c[2] >= 2 or (c[2] == 1 and c[3] >= 1)) or c[3] >= 1)):
		ans = 'YES'
	for i in range(q):
		ans = 'NO'
		x = input().rstrip().split()
		if x[0] == '+':
			y = int(x[1])
			temp = b[y]
			b[y] = b[y] + 1
			if temp < 8:
				c[temp] -= 1
				if b[y] < 8:
					c[b[y]] += 1
				else:
					c[8] += 1
		else:
			y = int(x[1])
			temp = b[y]
			b[y] = b[y] - 1
			if temp <= 8:
				c[temp] -= 1
				c[b[y]] += 1
		if c[8] >= 1 or c[4] >= 2 or c[5] >= 2 or (c[6] >= 2) or (c[7] >= 2) or (c[7] >= 1 and (c[4] >= 1 or c[5] >= 1 or c[6] >= 1)) or (c[6] >= 1 and (c[5] >= 1 or c[4] >= 1)) or (c[5] >= 1 and c[4] >= 1) or ((c[4] == 1 or c[5] == 1) and ((c[2] >= 2 or c[3] >= 2) or (c[2] >= 1 and c[3] >= 1))) or ((c[6] == 1 or c[7] == 1) and (c[2] >= 1 or c[3] >= 1 or c[4] >= 1 or (c[5] >= 1))):
			ans = 'YES'
		print(ans)
main()


from collections import Counter

def main():
	n = int(input())
	a = list(map(int, input().split()))
	d = dict(Counter(a))
	d1 = {2: set(), 4: set()}
	for i in d:
		if d[i] >= 4:
			d1[4].add(i)
		if d[i] >= 2 and (not 4 <= d[i] < 6):
			d1[2].add(i)
	for i in range(int(input())):
		qv = input()
		if qv[0] == '+':
			qv = int(qv[2:])
		else:
			qv = -int(int(qv[2:]))
		if qv > 0 and qv in d:
			d[qv] += 1
			if d[qv] == 4:
				d1[4].add(qv)
				if qv in d1[2]:
					d1[2].discard(qv)
			if d[qv] == 2 or d[qv] == 6:
				d1[2].add(qv)
		elif qv > 0:
			d[qv] = 1
		elif qv < 0:
			qv = abs(qv)
			d[abs(qv)] -= 1
			if d[qv] == 1:
				d1[2].discard(qv)
			elif d[qv] == 3:
				d1[4].discard(qv)
				d1[2].add(qv)
			elif d[qv] == 5:
				d1[2].discard(qv)
		if len(d1[4]) > 1 or (len(d1[4]) == 1 and d[list(d1[4])[0]] > 7) or (len(d1[4]) >= 1 and len(d1[2]) > 1):
			print('YES')
		else:
			print('NO')
main()


n = int(int(input()))
arr = [int(c) for c in input().split()]
g2 = 0
g4 = 0
g6 = 0
g8 = 0
mark = [0 for i in range(10 ** 5 + 10)]
for i in arr:
	mark[i] += 1
for i in mark:
	if i >= 8:
		g8 += 1
	elif i >= 6:
		g6 += 1
	elif i >= 4:
		g4 += 1
	elif i >= 2:
		g2 += 1
q = int(input())
for o in range(q):
	(a, b) = [c for c in input().split()]
	b = int(b)
	if a == '+':
		mark[b] += 1
		if mark[b] == 2:
			g2 += 1
		elif mark[b] == 4:
			g2 -= 1
			g4 += 1
		elif mark[b] == 6:
			g4 -= 1
			g6 += 1
		elif mark[b] == 8:
			g6 -= 1
			g8 += 1
	else:
		mark[b] -= 1
		if mark[b] == 7:
			g8 -= 1
			g6 += 1
		elif mark[b] == 5:
			g6 -= 1
			g4 += 1
		elif mark[b] == 3:
			g4 -= 1
			g2 += 1
		elif mark[b] == 1:
			g2 -= 1
	ans = False
	if g4 > 1 or g6 > 1 or g8 >= 1:
		ans = True
	if g4 == 1 and g2 >= 2:
		ans = True
	elif g6 == 1 and (g2 >= 1 or g4 == 1):
		ans = True
	if ans:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
planks = list(map(int, input().split()))
(amnt_4, amnt_2) = ([], [])
dct = defaultdict(int)
for i in planks:
	dct[i] += 1
	if dct[i] == 2:
		amnt_2.append(i)
	elif dct[i] == 4:
		amnt_4.append(i)
yes = 'YES'
no = 'NO'
q = int(input())
for _ in range(q):
	(sgn, i) = input().split()
	i = int(i)
	if sgn == '+':
		dct[i] += 1
		if dct[i] == 2:
			amnt_2.append(i)
		elif dct[i] == 4:
			amnt_4.append(i)
	else:
		dct[i] -= 1
		if dct[i] == 1:
			amnt_2.remove(i)
		if dct[i] == 3:
			amnt_4.remove(i)
	if len(amnt_4) >= 2:
		print(yes)
	elif len(amnt_4) == 1:
		plnk = amnt_4[0]
		if dct[plnk] >= 8:
			print(yes)
		elif len(amnt_2) >= 3:
			print(yes)
		elif len(amnt_2) == 2 and dct[plnk] >= 6:
			print(yes)
		else:
			print(no)
	else:
		print(no)


import collections
import heapq
import sys
data = sys.stdin.read().split()[::-1]

def inp():
	return data.pop()
n = int(inp())
s2 = set()
s4 = set()
s6 = set()
s8 = set()
planks = [int(inp()) for _ in range(n)]
counters = collections.Counter(planks)

def process(k, v):
	global s2, s4, s6, s8
	if v >= 8:
		s8.add(k)
	elif v >= 6:
		s6.add(k)
	elif v >= 4:
		s4.add(k)
	elif v >= 2:
		s2.add(k)
for (k, v) in counters.items():
	process(k, v)
q = int(inp())
ans = []
for _ in range(q):
	sign = inp()
	inc = -1 if sign == '-' else 1
	length = int(inp())
	counters[length] += inc
	for s in (s2, s4, s6, s8):
		if length in s:
			s.remove(length)
	process(length, counters[length])
	if s8 or len(s6) > 1 or len(s4) > 1 or (s6 and s4) or (s6 and s2) or (s4 and len(s2) > 1):
		cur_ans = 'YES'
	else:
		cur_ans = 'NO'
	ans.append(cur_ans)
print('\n'.join(ans))


def check(f):
	if f[3] >= 1:
		print('YES')
	elif f[2] > 1:
		print('YES')
	elif f[1] > 1:
		print('YES')
	elif f[2] == 1 and (f[1] >= 1 or f[0] >= 1):
		print('YES')
	elif f[1] == 1 and f[0] >= 2:
		print('YES')
	else:
		print('NO')
n = int(input())
q = [0] * 100000
x = list(map(int, input().split()))
for i in x:
	q[i - 1] += 1
f = [0] * 4
for i in q:
	if i == 2 or i == 3:
		f[0] += 1
	if i == 4 or i == 5:
		f[1] += 1
	if i == 6 or i == 7:
		f[2] += 1
	if i >= 8:
		f[3] += 1
for _ in range(int(input())):
	v = list(map(str, input().split()))
	if v[0] == '+':
		p = int(v[1])
		c = q[p - 1]
		q[p - 1] += 1
		if c == 1:
			f[0] += 1
		elif c == 3:
			f[0] -= 1
			f[1] += 1
		elif c == 5:
			f[1] -= 1
			f[2] += 1
		elif c == 7:
			f[2] -= 1
			f[3] += 1
		check(f)
	else:
		p = int(v[1])
		c = q[p - 1]
		q[p - 1] -= 1
		if c == 2:
			f[0] -= 1
		elif c == 4:
			f[1] -= 1
			f[0] += 1
		elif c == 6:
			f[2] -= 1
			f[1] += 1
		elif c == 8:
			f[2] += 1
			f[3] -= 1
		check(f)


from collections import Counter
ii = int(input())
a = list(map(int, input().split()))
co = dict(Counter(a))
l = co.values()
(ei, fo, tw, si) = (0, 0, 0, 0)
for kk in l:
	if kk > 7:
		ei += 1
		si += 1
		fo += 1
		tw += 1
	elif kk > 5:
		si += 1
		fo += 1
		tw += 1
	elif kk > 3:
		fo += 1
		tw += 1
	elif kk > 1:
		tw += 1
for jj in range(int(input())):
	q = input()
	s = q[0]
	n = int(q[1:])
	if s == '+':
		try:
			co[n] += 1
			if co[n] == 8:
				ei += 1
			elif co[n] == 6:
				si += 1
			elif co[n] == 4:
				fo += 1
			elif co[n] == 2:
				tw += 1
		except:
			co[n] = 1
	else:
		co[n] -= 1
		if co[n] == 7:
			ei -= 1
		elif co[n] == 5:
			si -= 1
		elif co[n] == 3:
			fo -= 1
		elif co[n] == 1:
			tw -= 1
	if ei == 1 or fo >= 2 or (si >= 1 and tw >= 2) or (fo >= 1 and tw >= 3):
		print('YES')
	else:
		print('NO')


no_planks = int(input())
planks = map(int, input().split(' '))
plank_count = [0] * 100002
len2 = set()
len4 = set()
len6 = set()
len8 = set()
for p in planks:
	plank_count[p] += 1
	if plank_count[p] == 2:
		len2.add(p)
	if plank_count[p] == 4:
		len2.remove(p)
		len4.add(p)
	if plank_count[p] == 6:
		len4.remove(p)
		len6.add(p)
	if plank_count[p] == 8:
		len6.remove(p)
		len8.add(p)
no_op = int(input())
for i in range(no_op):
	inp = input().split(' ')
	p = int(inp[1])
	if inp[0] == '-':
		plank_count[p] -= 1
		if plank_count[p] == 1:
			len2.remove(p)
		if plank_count[p] == 3:
			len4.remove(p)
			len2.add(p)
		if plank_count[p] == 5:
			len6.remove(p)
			len4.add(p)
		if plank_count[p] == 7:
			len8.remove(p)
			len6.add(p)
	else:
		plank_count[p] += 1
		if plank_count[p] == 2:
			len2.add(p)
		if plank_count[p] == 4:
			len2.remove(p)
			len4.add(p)
		if plank_count[p] == 6:
			len4.remove(p)
			len6.add(p)
		if plank_count[p] == 8:
			len6.remove(p)
			len8.add(p)
	if len(len8) >= 1 or (len(len6) >= 1 and (len(len6) >= 2 or len(len4) >= 1 or len(len2) >= 1)) or (len(len4) >= 1 and (len(len4) >= 2 or len(len2) >= 2)):
		print('YES')
	else:
		print('NO')


from collections import defaultdict

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	planks = defaultdict(int)
	eigth = set()
	six = set()
	four = set()
	two = set()
	for i in a:
		planks[i] += 1
	for i in planks:
		if planks[i] >= 8:
			eigth.add(i)
		elif planks[i] >= 6:
			six.add(i)
		elif planks[i] >= 4:
			four.add(i)
		elif planks[i] >= 2:
			two.add(i)
	q = int(input())
	for _ in range(q):
		(s, m) = input().split()
		m = int(m)
		if s == '+':
			planks[m] += 1
			if planks[m] == 8:
				eigth.add(m)
				six.remove(m)
			elif planks[m] == 6:
				six.add(m)
				four.remove(m)
			elif planks[m] == 4:
				four.add(m)
				two.remove(m)
			elif planks[m] == 2:
				two.add(m)
		else:
			planks[m] -= 1
			if planks[m] == 7:
				eigth.remove(m)
				six.add(m)
			elif planks[m] == 5:
				six.remove(m)
				four.add(m)
			elif planks[m] == 3:
				four.remove(m)
				two.add(m)
			elif planks[m] == 1:
				two.remove(m)
		tot = 4 * len(four) + 6 * len(six) + 8 * len(eigth)
		if tot >= 4:
			tot -= 4
			tot += 2 * len(two)
			if tot >= 4:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
t = 1
for test in range(t):
	solve()


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
n = II()
a = LI()
d = [0] * (10 ** 5 + 1)
t = 0
e = 0
for i in a:
	d[i] += 1
	if d[i] % 4 == 0:
		t += 1
		e -= 1
	elif d[i] % 2 == 0:
		e += 1
for j in range(int(input())):
	(q, i) = input().split()
	i = int(i)
	if q == '+':
		d[i] += 1
		if d[i] % 4 == 0:
			t += 1
			e -= 1
		elif d[i] % 2 == 0:
			e += 1
	else:
		d[i] -= 1
		if d[i] % 4 == 3:
			t -= 1
			e += 1
		elif d[i] % 4 == 1:
			e -= 1
	boo = False
	if t > 1:
		boo = True
	elif t == 1 and e > 1:
		boo = True
	print('YES' if boo else 'NO')


n = map(int, input().split())
a = [*map(int, input().split())]
datastore = [set() for x in range(9)]
inpres = set()
count = dict()
for plank in a:
	if plank in inpres:
		datastore[count[plank] if count[plank] <= 8 else 8].remove(plank)
		count[plank] += 1
		datastore[count[plank] if count[plank] <= 8 else 8].add(plank)
	else:
		count[plank] = 1
		inpres.add(plank)
		datastore[1].add(plank)
for q in range(int(input())):
	(sign, value) = input().split()
	plank = int(value)
	if sign == '+':
		if plank in inpres:
			datastore[count[plank] if count[plank] <= 8 else 8].remove(plank)
			count[plank] += 1
			datastore[count[plank] if count[plank] <= 8 else 8].add(plank)
		else:
			count[plank] = 1
			inpres.add(plank)
			datastore[1].add(plank)
	else:
		datastore[count[plank] if count[plank] <= 8 else 8].remove(plank)
		count[plank] -= 1
		if count[plank] == 0:
			inpres.remove(plank)
		else:
			datastore[count[plank] if count[plank] <= 8 else 8].add(plank)
	answer = 'NO'
	if len(datastore[8]) > 0:
		answer = 'YES'
	elif len(datastore[7]) + len(datastore[6]) + len(datastore[5]) + len(datastore[4]) >= 2:
		answer = 'YES'
	elif len(datastore[7]) + len(datastore[6]) + len(datastore[5]) + len(datastore[4]) == 0:
		pass
	elif len(datastore[4]) + len(datastore[5]) == 1:
		if len(datastore[3]) + len(datastore[2]) >= 2:
			answer = 'YES'
	elif len(datastore[3]) + len(datastore[2]) >= 1:
		answer = 'YES'
	print(answer)


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial, gcd
from collections import deque
n = int(input())
l = list(map(int, input().split()))
d = {}
for i in l:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
sq = 0
rec = 0
for i in d:
	sq = sq + d[i] // 4
	if d[i] % 4 >= 2:
		rec += 1
for i in range(int(input())):
	(a, b) = input().split()
	b = int(b)
	if a == '+' and b not in d:
		d[b] = 1
	else:
		x = d[b] // 4
		y = 0
		if d[b] % 4 >= 2:
			y = 1
		sq -= x
		rec -= y
		if a == '+':
			d[b] += 1
		else:
			d[b] -= 1
		sq += d[b] // 4
		if d[b] % 4 >= 2:
			rec += 1
	if sq >= 2:
		print('YES')
	elif sq == 1 and rec >= 2:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
exist = defaultdict(lambda : 0)
final = defaultdict(lambda : 0)
count = defaultdict(lambda : 0)
ar = list(map(int, input().split()))
for i in range(n):
	a = ar[i]
	if count[a] != 0:
		exist[count[a]] -= 1
	count[a] += 1
	exist[count[a]] += 1
	if count[a] == 2:
		final[2] += 1
	elif count[a] == 4:
		final[2] -= 1
		final[4] += 1
	elif count[a] == 6:
		final[4] -= 1
		final[6] += 1
	elif count[a] == 8:
		final[6] -= 1
		final[8] += 1
q = int(input())
for i in range(q):
	tmp = input().split()
	sign = tmp[0]
	a = int(tmp[1])
	if sign == '+':
		if count[a] != 0:
			exist[count[a]] -= 1
		count[a] += 1
		exist[count[a]] += 1
		if count[a] == 2:
			final[2] += 1
		elif count[a] == 4:
			final[2] -= 1
			final[4] += 1
		elif count[a] == 6:
			final[4] -= 1
			final[6] += 1
		elif count[a] == 8:
			final[6] -= 1
			final[8] += 1
	else:
		if count[a] != 0:
			exist[count[a]] -= 1
		count[a] -= 1
		exist[count[a]] += 1
		if count[a] == 1:
			final[2] -= 1
		elif count[a] == 3:
			final[2] += 1
			final[4] -= 1
		elif count[a] == 5:
			final[4] += 1
			final[6] -= 1
		elif count[a] == 7:
			final[6] += 1
			final[8] -= 1
	if final[8] >= 1:
		print('YES')
	elif final[6] >= 2:
		print('YES')
	elif final[4] >= 2:
		print('YES')
	elif final[6] == 1 and (final[2] >= 1 or final[4] >= 1):
		print('YES')
	elif final[4] >= 1 and final[2] >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = input().split()
d = dict()
count = [0] * 100001
for i in a:
	if i not in d:
		d[i] = 1
		count[1] += 1
	else:
		d[i] += 1
		count[d[i]] += 1
q = int(input())
for i in range(q):
	s = input().split()
	if s[1] in d:
		if s[0] == '+':
			d[s[1]] += 1
			count[d[s[1]]] += 1
		else:
			count[d[s[1]]] -= 1
			d[s[1]] -= 1
	else:
		d[s[1]] = 1
	if count[8] > 0 or (count[6] > 0 and (count[4] > 1 or count[2] > 1)) or (count[4] > 0 and count[2] > 2) or (count[4] > 1):
		print('YES')
	else:
		print('NO')


from collections import defaultdict
d1 = defaultdict(int)
d2 = defaultdict(int)
d4 = defaultdict(int)
r = defaultdict(int)
n = int(input())
a = list(map(int, input().split()))
for i in a:
	d1[i] += 1
gf = 0
gt = 0
for i in d1:
	d2[i] += d1[i] % 4 // 2
	d4[i] += d1[i] // 4
	gf += d1[i] // 4
	gt += d1[i] % 4 // 2
	r[i] = d1[i] % 2
q = int(input())
for _ in range(q):
	(u, i) = map(str, input().split())
	m = int(i)
	if u == '+':
		d1[m] += 1
		if r[m] == 1:
			r[m] -= 1
			if d2[m]:
				gt -= 1
				d2[m] -= 1
				gf += 1
				d4[m] += 1
			else:
				gt += 1
				d2[m] += 1
		else:
			r[m] += 1
		if gf >= 2 or (gf >= 1 and gt >= 2):
			print('YES')
		else:
			print('NO')
	else:
		d1[m] -= 1
		if r[m] == 1:
			r[m] -= 1
		else:
			r[m] = 1
			if d2[m]:
				d2[m] -= 1
				gt -= 1
			else:
				d4[m] -= 1
				gf -= 1
				gt += 1
				d2[m] += 1
		if gf >= 2 or (gf >= 1 and gt >= 2):
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
data = [0] * (10 ** 5 + 1)
for i in range(n):
	data[a[i]] += 1
(zero, two, four, six, eight) = (0, 0, 0, 0, 0)
for i in range(1, 10 ** 5 + 1):
	if data[i] <= 1:
		zero += 1
	elif data[i] <= 3:
		two += 1
	elif data[i] <= 5:
		four += 1
	elif data[i] <= 7:
		six += 1
	else:
		eight += 1
for i in range(int(input())):
	(t, m) = input().split()
	m = int(m)
	if t == '+':
		if data[m] == 7:
			eight += 1
			six -= 1
		elif data[m] == 5:
			six += 1
			four -= 1
		elif data[m] == 3:
			four += 1
			two -= 1
		elif data[m] == 1:
			two += 1
		data[m] += 1
	else:
		if data[m] == 8:
			eight -= 1
			six += 1
		elif data[m] == 6:
			six -= 1
			four += 1
		elif data[m] == 4:
			four -= 1
			two += 1
		elif data[m] == 2:
			two -= 1
		data[m] -= 1
	if eight:
		print('YES')
	elif six >= 2:
		print('YES')
	elif six == 1:
		if four or two:
			print('YES')
		else:
			print('NO')
	elif four >= 2:
		print('YES')
	elif four and two >= 2:
		print('YES')
	else:
		print('NO')


x = int(input())
d = [int(i) for i in input().split()]
dict1 = {}
for i in d:
	if dict1.get(i) == None:
		dict1[i] = 1
	else:
		dict1[i] += 1
count = 0
count1 = 0
for i in dict1:
	count += dict1[i] // 2
	count1 += dict1[i] // 4
for i in range(int(input())):
	g = [j for j in input().split()]
	if dict1.get(int(g[1])) == None:
		dict1[int(g[1])] = 1
	else:
		count -= dict1[int(g[1])] // 2
		count1 -= dict1[int(g[1])] // 4
		if g[0] == '+':
			dict1[int(g[1])] += 1
		else:
			dict1[int(g[1])] -= 1
		count += dict1[int(g[1])] // 2
		count1 += dict1[int(g[1])] // 4
	if count >= 4 and count1 >= 1:
		print('YES')
	else:
		print('NO')


import atexit
import io
import sys
_I_B = sys.stdin.read().splitlines()
input = iter(_I_B).__next__
_O_B = io.StringIO()
sys.stdout = _O_B

@atexit.register
def write():
	sys.__stdout__.write(_O_B.getvalue())

def main():
	n = int(input())
	a = list(map(int, input().split()))
	ca = [0] * (10 ** 5 + 1)
	d = {4: 0, 2: 0}
	m = 10 ** 5 + 1
	for i in a:
		if m < i:
			m = i
		ca[i] += 1
	for i in range(1, m):
		t = ca[i]
		d[4] += t // 4
		t %= 4
		d[2] += t // 2
	for _ in range(int(input())):
		q = input().strip().split()
		i = int(q[1])
		t = ca[i]
		d[4] -= t // 4
		t %= 4
		d[2] -= t // 2
		if q[0] == '+':
			ca[i] += 1
		else:
			ca[i] -= 1
		t = ca[i]
		d[4] += t // 4
		t %= 4
		d[2] += t // 2
		if d[4] > 1 or (d[4] == 1 and d[2] > 1):
			print('YES')
		else:
			print('NO')
main()


from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split(' ')))
m = int(stdin.readline().rstrip())
d = {}
for i in range(n):
	if not d.get(str(l[i]), 0):
		d[str(l[i])] = 0
	d[str(l[i])] += 1
c_2 = 0
c_4 = 0
c_6 = 0
c_8 = 0
for (k, v) in d.items():
	if v >= 8:
		c_8 += 1
	elif v >= 6:
		c_6 += 1
	elif v > 3:
		c_4 += 1
	elif v >= 2:
		c_2 += 1
for i in range(m):
	(s, val) = stdin.readline().rstrip().split(' ')
	if not d.get(val, 0):
		d[val] = 0
	if s == '-':
		d[str(val)] -= 1
		if d[val] == 7:
			c_8 -= 1
			c_6 += 1
		elif d[val] == 5:
			c_6 -= 1
			c_4 += 1
		elif d[val] == 3:
			c_2 += 1
			c_4 -= 1
		elif d[val] == 1:
			c_2 -= 1
	elif s == '+':
		d[val] += 1
		if d[val] == 8:
			c_6 -= 1
			c_8 += 1
		elif d[val] == 6:
			c_4 -= 1
			c_6 += 1
		elif d[val] == 4:
			c_2 -= 1
			c_4 += 1
		elif d[val] == 2:
			c_2 += 1
	if c_8 >= 1 or c_4 >= 2 or c_6 >= 2:
		print('YES')
	elif c_6 >= 1 and c_4 >= 1:
		print('YES')
	elif c_6 >= 1 and c_2 >= 1:
		print('YES')
	elif c_4 >= 1 and c_2 > 1:
		print('YES')
	else:
		print('NO')


from collections import Counter

def main():
	n = int(input())
	a = Counter(map(int, input().split()))
	q = int(input())
	(n2, n4, n6, n8) = (0, 0, 0, 0)
	for i in a.values():
		if i >= 2:
			n2 += 1
		if i >= 4:
			n4 += 1
		if i >= 6:
			n6 += 1
		if i >= 8:
			n8 += 1
	for _ in range(q):
		(s, k) = input().split()
		k = int(k)
		if s == '+':
			if k not in a:
				a[k] = 0
			a[k] += 1
			if a[k] == 2:
				n2 += 1
			elif a[k] == 4:
				n4 += 1
			elif a[k] == 6:
				n6 += 1
			elif a[k] == 8:
				n8 += 1
		else:
			a[k] -= 1
			if a[k] == 1:
				n2 -= 1
			elif a[k] == 3:
				n4 -= 1
			elif a[k] == 5:
				n6 -= 1
			elif a[k] == 7:
				n8 -= 1
		if n8 > 0 or n6 > 1 or (n6 == 1 and n2 > 1) or (n4 > 1) or (n4 == 1 and n2 > 2):
			print('YES')
		else:
			print('NO')
main()


import sys
import math
import heapq
import collections
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
n = inputnum()
a = inputlist()
b = [0] * 1000000
twos = 0
fours = 0
for i in range(n):
	b[a[i]] += 1
	if b[a[i]] % 2 == 0:
		twos += 1
	if b[a[i]] % 4 == 0:
		fours += 1
q = inputnum()
for i in range(q):
	s = input()
	x = int(s[2:])
	if s[0] == '+':
		b[x] += 1
		if b[x] % 2 == 0:
			twos += 1
		if b[x] % 4 == 0:
			fours += 1
	else:
		b[x] -= 1
		if b[x] % 2 == 1:
			twos -= 1
		if b[x] % 4 == 3:
			fours -= 1
	if fours >= 1 and twos - 2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
b = [0] * 100001
c = [0] * 100001
for i in a:
	b[i] += 1
	c[b[i]] += 1
q = int(input())
for _ in range(q):
	(e, z) = input().split()
	z = int(z)
	if e == '+':
		b[z] += 1
		c[b[z]] += 1
	elif e == '-':
		c[b[z]] -= 1
		b[z] -= 1
	if c[8] > 0 or c[4] > 1 or (c[6] > 0 and c[2] > 1) or (c[4] > 0 and c[2] > 2):
		print('YES')
	else:
		print('NO')


def process(planks, events):
	results = []
	tows = []
	fours = []
	for elem in planks.keys():
		if planks[elem] == 1:
			pass
		elif 1 < planks[elem] < 4:
			tows.append(elem)
		else:
			fours.append(elem)
	for event in events:
		if event[0] == '+':
			if event[1] not in planks.keys() or planks[event[1]] == 0:
				planks[event[1]] = 1
			elif planks[event[1]] == 1:
				tows.append(event[1])
				planks[event[1]] += 1
			elif planks[event[1]] == 3:
				fours.append(event[1])
				tows.remove(event[1])
				planks[event[1]] += 1
			else:
				planks[event[1]] += 1
		elif planks[event[1]] == 1:
			planks[event[1]] = 0
		elif planks[event[1]] == 2:
			planks[event[1]] = 1
			tows.remove(event[1])
		elif planks[event[1]] == 4:
			fours.remove(event[1])
			tows.append(event[1])
			planks[event[1]] -= 1
		else:
			planks[event[1]] -= 1
		if len(fours) >= 2:
			results.append('YES')
		elif len(fours) == 1 and planks[fours[0]] >= 6 and (len(tows) >= 1):
			results.append('YES')
		elif len(fours) == 1 and len(tows) >= 2:
			results.append('YES')
		elif len(fours) == 1 and planks[fours[0]] >= 8:
			results.append('YES')
		else:
			results.append('NO')
	return results
n = int(input())
planks = {}
l = [int(x) for x in input().split()]
for num in range(n):
	if l[num] in planks.keys():
		planks[l[num]] += 1
	else:
		planks[l[num]] = 1
s = int(input())
events = []
for num in range(s):
	q = input().split()
	events.append([q[0], int(q[1])])
results = process(planks, events)
for result in results:
	print(result)


n = int(input())
a = list(map(int, input().split()))
x = 10 ** 5 + 1
length = [0] * x
for i in range(n):
	length[a[i]] += 1
num2468 = [0] * 4
for i in range(x):
	temp = length[i]
	if temp >= 8:
		num2468[3] += 1
	elif temp >= 6:
		num2468[2] += 1
	elif temp >= 4:
		num2468[1] += 1
	elif temp >= 2:
		num2468[0] += 1
q = int(input())
for _ in range(q):
	query = list(map(str, input().split()))
	temp = length[int(query[1])]
	if query[0] == '+':
		length[int(query[1])] += 1
		if temp == 7:
			num2468[2] -= 1
			num2468[3] += 1
		elif temp == 5:
			num2468[1] -= 1
			num2468[2] += 1
		elif temp == 3:
			num2468[0] -= 1
			num2468[1] += 1
		elif temp == 1:
			num2468[0] += 1
	if query[0] == '-':
		length[int(query[1])] -= 1
		if temp == 8:
			num2468[2] += 1
			num2468[3] -= 1
		elif temp == 6:
			num2468[1] += 1
			num2468[2] -= 1
		elif temp == 4:
			num2468[0] += 1
			num2468[1] -= 1
		elif temp == 2:
			num2468[0] -= 1
	SUM = sum(num2468)
	if num2468[3] != 0:
		print('YES')
	elif num2468[2] != 0 and SUM >= 2:
		print('YES')
	elif num2468[1] >= 2:
		print('YES')
	elif num2468[1] == 1 and SUM >= 3:
		print('YES')
	else:
		print('NO')


from collections import Counter

def main():
	n = int(input())
	c = Counter(map(int, input().split()))
	(s2, s4) = (0, 0)
	for v in c:
		s4 += c[v] // 4
		s2 += c[v] // 2
	s2 -= 2
	for q in range(int(input())):
		(a, b) = map(str, input().split())
		s4 -= c[int(b)] // 4
		s2 -= c[int(b)] // 2
		if a == '+':
			c[int(b)] += 1
		else:
			c[int(b)] -= 1
		s4 += c[int(b)] // 4
		s2 += c[int(b)] // 2
		if s4 >= 2:
			print('YES')
			continue
		if s4 >= 1 and s2 >= 2:
			print('YES')
			continue
		else:
			print('NO')
main()


from math import *
from collections import *
from random import *
from decimal import Decimal
from heapq import *
from bisect import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 5)

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())

def inp():
	return int(input())

def st1():
	return input().rstrip('\n')
n = inp()
a = lis()
f = Counter(a)
sq = {}
nop = {}
for i in f.keys():
	if f[i] >= 4:
		sq[i] = f[i]
	elif f[i] >= 2:
		nop[i] = f[i]
q = inp()
for i in range(q):
	x = input().split()
	ty = x[0]
	el = int(x[1])
	if ty == '+':
		try:
			f[el] += 1
		except:
			f[el] = 1
		if f[el] >= 4:
			try:
				sq[el] += 1
			except:
				sq[el] = 4
			if el in nop:
				del nop[el]
		elif f[el] >= 2:
			try:
				nop[el] += 1
			except:
				nop[el] = 2
	else:
		f[el] -= 1
		if f[el] < 4 and f[el] > 2:
			try:
				del sq[el]
			except:
				pass
			if el not in nop:
				if f[el] >= 2:
					nop[el] = f[el]
		elif f[el] < 2:
			try:
				del nop[el]
			except:
				pass
		else:
			try:
				sq[el] -= 1
			except:
				pass
			try:
				nop[el] -= 1
			except:
				pass
	s = 'YES'
	if len(sq) == 0:
		s = 'NO'
	if len(sq) == 1:
		for i in sq.keys():
			z = sq[i]
		if len(nop) == 0 and z - 4 < 4:
			s = 'NO'
		elif len(nop) == 1 and z - 4 < 2:
			s = 'NO'
		if z - 4 >= 4:
			s = 'YES'
	print(s)


n = int(input())
p_ls = list(map(int, input().split()))
p_dict = {}
square_set = 0
rectangle_set = 0
p_dict = {}
for p in p_ls:
	if p in p_dict:
		p_dict[p] += 1
	else:
		p_dict[p] = 1
	if p_dict[p] % 4 == 0:
		square_set += 1
	if p_dict[p] % 2 == 0:
		rectangle_set += 1
events = int(input())
for e in range(events):
	(action, p) = input().split()
	p = int(p)
	if action == '-':
		if p_dict[p] % 4 == 0:
			square_set -= 1
		if p_dict[p] % 2 == 0:
			rectangle_set -= 1
		p_dict[p] -= 1
	elif action == '+':
		if p in p_dict:
			p_dict[p] += 1
		else:
			p_dict[p] = 1
		if p_dict[p] % 4 == 0:
			square_set += 1
		if p_dict[p] % 2 == 0:
			rectangle_set += 1
	if square_set >= 2:
		print('YES')
	elif square_set == 0:
		print('NO')
	elif rectangle_set >= 4:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
u = [0] * int(100000.0 + 1)
for i in a:
	u[i] += 1
can1 = 0
can2 = 0
for i in u:
	can1 += i // 4
	can2 += i % 4 // 2
q = int(input())
for i in range(q):
	(p, x) = map(str, input().split())
	x = int(x)
	if p == '+':
		u[x] += 1
		if u[x] % 4 == 0:
			can1 += 1
			can2 -= 1
		elif u[x] % 4 == 2:
			can2 += 1
	else:
		u[x] -= 1
		if u[x] % 4 == 3:
			can1 -= 1
			can2 += 1
		elif u[x] % 4 == 1:
			can2 -= 1
	if can1 >= 2 or (can1 == 1 and can2 >= 2):
		print('YES')
	else:
		print('NO')


import sys
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if a[i] in d:
			d[a[i]] += 1
		else:
			d[a[i]] = 1
	s2 = 0
	s4 = 0
	key = list(d.keys())
	for i in key:
		if d[i] >= 4:
			s4 += d[i] // 4
		if d[i] % 4 >= 2:
			s2 += 1
	ans = ''
	q = int(input())
	for ppp in range(q):
		(x, y) = input().split()
		y = int(y)
		if x == '+':
			if y in d:
				ini = d[y]
				d[y] += 1
				fin = d[y]
				if ini // 4 != fin // 4:
					s4 += 1
					s2 -= 1
				if ini % 4 < 2 and fin % 4 >= 2:
					s2 += 1
			else:
				d[y] = 1
		else:
			ini = d[y]
			d[y] -= 1
			fin = d[y]
			if ini // 4 != fin // 4:
				s4 -= 1
			if ini % 4 < 2 and fin % 4 >= 2:
				s2 += 1
			if ini % 4 >= 2 and fin % 4 < 2:
				s2 -= 1
		if s4 >= 2:
			ans = 'YES'
		elif s4 >= 1 and s2 >= 2:
			ans = 'YES'
		else:
			ans = 'NO'
		print(ans)


from collections import defaultdict
n = int(input())
list1 = list(map(int, input().split()))
d = defaultdict(int)
for i in range(len(list1)):
	d[list1[i]] += 1
d2 = {8: 0, 6: 0, 4: 0, 2: 0, 0: 0}
for i in d.keys():
	if d[i] >= 8:
		d2[8] += 1
	elif d[i] >= 6:
		d2[6] += 1
	elif d[i] >= 4:
		d2[4] += 1
	elif d[i] >= 2:
		d2[2] += 1
	else:
		d2[0] += 1
q = int(input())
for i in range(q):
	a = list(map(str, input().split()))
	if a[0] == '-':
		if d[int(a[1])] < 2:
			d2[0] -= 1
		elif d[int(a[1])] < 4:
			d2[2] -= 1
		elif d[int(a[1])] < 6:
			d2[4] -= 1
		elif d[int(a[1])] < 8:
			d2[6] -= 1
		else:
			d2[8] -= 1
		d[int(a[1])] -= 1
		if d[int(a[1])] >= 8:
			d2[8] += 1
		elif d[int(a[1])] >= 6:
			d2[6] += 1
		elif d[int(a[1])] >= 4:
			d2[4] += 1
		elif d[int(a[1])] >= 2:
			d2[2] += 1
		else:
			d2[0] += 1
	else:
		if d[int(a[1])] < 2:
			d2[0] -= 1
		elif d[int(a[1])] < 4:
			d2[2] -= 1
		elif d[int(a[1])] < 6:
			d2[4] -= 1
		elif d[int(a[1])] < 8:
			d2[6] -= 1
		else:
			d2[8] -= 1
		d[int(a[1])] += 1
		if d[int(a[1])] >= 8:
			d2[8] += 1
		elif d[int(a[1])] >= 6:
			d2[6] += 1
		elif d[int(a[1])] >= 4:
			d2[4] += 1
		elif d[int(a[1])] >= 2:
			d2[2] += 1
		else:
			d2[0] += 1
	sq = 0
	rec = 0
	c = 0
	if d2[8] >= 1:
		sq = 1
		rec = 1
	if d2[6] >= 1:
		sq = 1
		if d2[2] >= 1 or d2[4] >= 1 or d2[6] >= 2:
			rec = 1
	if d2[4] >= 1:
		sq = 1
		if d2[4] >= 2 or d2[2] >= 2:
			rec = 1
	if sq == rec == 1:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
(n4, n2) = (0, 0)
freq = defaultdict(int)

def add(x):
	global n2, n4
	freq[x] += 1
	if freq[x] % 2 == 0:
		n2 += 1
	if freq[x] % 4 == 0:
		n4 += 1

def sub(x):
	global n2, n4
	old = freq[x]
	freq[x] -= 1
	if old % 2 == 0:
		n2 -= 1
	if old % 4 == 0:
		n4 -= 1
N = int(input())
a = [int(x) for x in input().split(' ')]
for x in a:
	add(x)
Q = int(input())
for _ in range(Q):
	(t, x) = input().split(' ')
	x = int(x)
	if t == '+':
		add(x)
	else:
		sub(x)
	print('YES' if n4 >= 1 and n2 - 2 >= 2 else 'NO')


import os
import sys
from collections import Counter
from io import BytesIO, IOBase

def main():
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	q = int(input())
	b = Counter(a)
	c = [0] * 9
	for i in b:
		if b[i] < 8:
			c[b[i]] += 1
		else:
			c[-1] += 1
	ans = 'NO'
	for i in range(q):
		ans = 'NO'
		x = input().rstrip().split()
		y = int(x[1])
		temp = b[y]
		if x[0] == '+':
			b[y] = b[y] + 1
			if temp < 8:
				c[temp] -= 1
				if b[y] < 8:
					c[b[y]] += 1
				else:
					c[8] += 1
		else:
			b[y] = b[y] - 1
			if temp <= 8:
				c[temp] -= 1
				c[b[y]] += 1
		if c[8] >= 1 or c[4] >= 2 or c[5] >= 2 or (c[6] >= 2) or (c[7] >= 2) or (c[7] >= 1 and (c[4] >= 1 or c[5] >= 1 or c[6] >= 1)) or (c[6] >= 1 and (c[5] >= 1 or c[4] >= 1)) or (c[5] >= 1 and c[4] >= 1) or ((c[4] == 1 or c[5] == 1) and ((c[2] >= 2 or c[3] >= 2) or (c[2] >= 1 and c[3] >= 1))) or ((c[6] == 1 or c[7] == 1) and (c[2] >= 1 or c[3] >= 1 or c[4] >= 1 or (c[5] >= 1))):
			ans = 'YES'
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict, Counter
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
pl = listIn()
di = defaultdict(int)
for i in range(n):
	di[pl[i]] += 1
l = n
q = intIn()
(cntt, cntf) = (0, 0)
(t, f) = (set(), set())
for ele in di:
	if di[ele] >= 4:
		cntf += 1
		f.add(ele)
	elif di[ele] >= 2:
		cntt += 1
		t.add(ele)
for i in range(q):
	(s, x) = stringListIn()
	x = int(x)
	if s == '+':
		di[x] += 1
		l += 1
		if di[x] == 4:
			f.add(x)
			if x in t:
				t.remove(x)
		elif di[x] == 2:
			t.add(x)
	else:
		di[x] -= 1
		l -= 1
		if di[x] < 2 and x in t:
			t.remove(x)
		elif di[x] < 4 and di[x] >= 2:
			if x in f:
				f.remove(x)
			t.add(x)
	(cntf, cntt) = (len(f), len(t))
	if l < 8:
		print('NO')
	elif cntt >= 2:
		if cntf >= 1:
			print('YES')
		else:
			print('NO')
	elif cntt == 1:
		if cntf > 1:
			print('YES')
		elif cntf == 1:
			ele = list(f)[0]
			if di[ele] >= 6:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	elif cntf >= 2:
		print('YES')
	elif cntf == 1:
		ele = list(f)[0]
		if di[ele] >= 8:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


pl = [0] * 100001
g2 = 0
g4 = 0
g6 = 0
g8 = 0
n = int(input())
for l in map(int, input().split()):
	pl[l] += 1
for l in range(100001):
	if pl[l] >= 8:
		g8 += 1
	elif pl[l] >= 6:
		g6 += 1
	elif pl[l] >= 4:
		g4 += 1
	elif pl[l] >= 2:
		g2 += 1
q = int(input())
for _ in range(q):
	(t, l) = input().split()
	l = int(l)
	if t == '+':
		pl[l] += 1
		if pl[l] == 2:
			g2 += 1
		elif pl[l] == 4:
			g2 -= 1
			g4 += 1
		elif pl[l] == 6:
			g4 -= 1
			g6 += 1
		elif pl[l] == 8:
			g6 -= 1
			g8 += 1
	else:
		pl[l] -= 1
		if pl[l] == 1:
			g2 -= 1
		elif pl[l] == 3:
			g4 -= 1
			g2 += 1
		elif pl[l] == 5:
			g6 -= 1
			g4 += 1
		elif pl[l] == 7:
			g8 -= 1
			g6 += 1
	if g8 >= 1:
		print('YES')
	elif g6 + g4 >= 2:
		print('YES')
	elif g6 == 1 and g2 >= 1:
		print('YES')
	elif g4 == 1 and g2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().strip().split()))[:n]
q = int(input())
n = len(a)
dict1 = {}
eight = set()
six = set()
two = set()
four = set()
for i in a:
	if i in dict1:
		dict1[i] += 1
	else:
		dict1[i] = 1
	if dict1[i] >= 8 and i not in eight:
		if i in six:
			six.remove(i)
		eight.add(i)
	elif dict1[i] >= 6 and i not in six and (i not in eight):
		if i in four:
			four.remove(i)
		six.add(i)
	elif dict1[i] >= 4 and i not in four and (i not in six) and (i not in eight):
		if i in two:
			two.remove(i)
		four.add(i)
	elif dict1[i] >= 2 and i not in two and (i not in four) and (i not in six) and (i not in eight):
		two.add(i)
while q:
	s = input()
	sym = s[0:1]
	val = int(s[2:])
	if sym == '+':
		i = val
		if i not in dict1:
			dict1[i] = 1
		else:
			dict1[i] += 1
		n += 1
		if dict1[i] >= 8 and i not in eight:
			if i in six:
				six.remove(i)
			eight.add(i)
		elif dict1[i] >= 6 and i not in six and (i not in eight):
			if i in four:
				four.remove(i)
			six.add(i)
		elif dict1[i] >= 4 and i not in four and (i not in six) and (i not in eight):
			if i in two:
				two.remove(i)
			four.add(i)
		elif dict1[i] >= 2 and i not in two and (i not in four) and (i not in six) and (i not in eight):
			two.add(i)
	else:
		i = val
		dict1[i] -= 1
		n -= 1
		if i in eight and dict1[i] < 8:
			eight.remove(i)
		if i in six and dict1[i] < 6:
			six.remove(i)
		if i in four and dict1[i] < 4:
			four.remove(i)
		if i in two and dict1[i] < 2:
			two.remove(i)
		if dict1[i] >= 8 and i not in eight:
			eight.add(i)
		if dict1[i] >= 6 and i not in six and (i not in eight):
			six.add(i)
		if dict1[i] >= 4 and i not in four and (i not in eight) and (i not in six):
			four.add(i)
		if dict1[i] >= 2 and i not in two and (i not in eight) and (i not in six) and (i not in four):
			two.add(i)
	if n >= 8:
		if len(eight) >= 1:
			print('YES')
		elif len(six) >= 2 or len(four) >= 2:
			print('YES')
		elif len(six) == 1 and (len(two) >= 1 or len(four) >= 1):
			print('YES')
		elif len(four) == 1 and len(two) >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')
	q -= 1


n = int(input())
lis = list(map(int, input().split()))
has = [0] * 100005
for i in lis:
	has[i] += 1
tmp = sorted(has[:], reverse=True)
q = int(input())
for _ in range(q):
	(a, b) = list(map(str, input().split()))
	if a == '+':
		b = int(b)
		fin = has[b]
		l = 0
		r = 100000
		while l <= r:
			mid = l + (r - l) // 2
			if tmp[mid] <= fin:
				r = mid - 1
			else:
				l = mid + 1
		has[b] += 1
		tmp[l] += 1
		if tmp[0] >= 8 or (tmp[0] >= 6 and tmp[1] >= 2) or (tmp[0] >= 4 and tmp[1] >= 2 and (tmp[2] >= 2)) or (tmp[0] >= 4 and tmp[1] >= 4):
			print('YES')
		else:
			print('NO')
	else:
		b = int(b)
		fin = has[b]
		l = 0
		r = 100000
		while l <= r:
			mid = l + (r - l) // 2
			if tmp[mid] < fin:
				r = mid - 1
			else:
				l = mid + 1
		has[b] -= 1
		tmp[r] -= 1
		if tmp[0] >= 8 or (tmp[0] >= 6 and tmp[1] >= 2) or (tmp[0] >= 4 and tmp[1] >= 2 and (tmp[2] >= 2)) or (tmp[0] >= 4 and tmp[1] >= 4):
			print('YES')
		else:
			print('NO')


import sys
import heapq
input = sys.stdin.readline
t = int(input())
p = list(map(int, input().split()))
a = set([])
b = set([])
c = set([])
d = set([])
D = {}
for num in p:
	if num not in D:
		D[num] = 1
	else:
		D[num] += 1
	if D[num] > 1:
		a.add(num)
	if D[num] > 3:
		b.add(num)
	if D[num] > 5:
		c.add(num)
	if D[num] > 7:
		d.add(num)
e = int(input())
for _ in range(e):
	ii = input().split()
	if ii[0] == '+':
		num = int(ii[1])
		if num not in D:
			D[num] = 1
		else:
			D[num] += 1
		if D[num] > 1:
			a.add(num)
		if D[num] > 3:
			b.add(num)
		if D[num] > 5:
			c.add(num)
		if D[num] > 7:
			d.add(num)
	if ii[0] == '-':
		num = int(ii[1])
		D[num] -= 1
		if D[num] < 2 and num in a:
			a.remove(num)
		if D[num] < 4 and num in b:
			b.remove(num)
		if D[num] < 6 and num in c:
			c.remove(num)
		if D[num] < 8 and num in d:
			d.remove(num)
	if len(b) > 0 and len(a) > 2:
		print('YES')
	elif len(b) > 1 or len(c) > 1:
		print('YES')
	elif len(b) > 0 and len(a) == 2 and (len(a - b) == 2):
		print('YES')
	elif len(c) > 0 and len(a) == 1 and (len(a - c) == 1):
		print('YES')
	elif len(c) > 0 and len(a) > 1:
		print('YES')
	elif len(d) > 0:
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
c = [0] * 100001
sq = 0
rct = 0
for i in l:
	c[i] += 1
	if c[i] % 4 == 0:
		sq += 1
	if c[i] % 2 == 0:
		rct += 1
for i in range(int(input())):
	(x, y) = map(str, input().split())
	y = int(y)
	if x == '+':
		c[y] += 1
		if c[y] % 4 == 0:
			sq += 1
		if c[y] % 2 == 0:
			rct += 1
	else:
		if c[y] % 4 == 0:
			sq -= 1
		if c[y] % 2 == 0:
			rct -= 1
		c[y] -= 1
	if sq > 1 or (sq and rct >= 4):
		print('YES')
	else:
		print('NO')


from collections import Counter
n = int(input())
a = [int(v) for v in input().split()]
d = dict(Counter(a))
r = 0
s = 0
for v in d:
	if d[v] >= 4:
		s = s + d[v] // 4
		if d[v] % 4 >= 2:
			r = r + 1
	elif d[v] >= 2:
		r = r + 1
q = int(input())
for j in range(q):
	st = input().split()
	p = int(st[1])
	if st[0] == '+':
		if p in d:
			d[p] = d[p] + 1
		else:
			d[p] = 1
	else:
		d[p] = d[p] - 1
	if st[0] == '+':
		if d[p] % 4 == 2:
			r = r + 1
		elif d[p] % 4 == 0:
			r = r - 1
			s = s + 1
	elif d[p] % 4 == 3:
		s = s - 1
		r = r + 1
	elif d[p] % 4 == 1:
		r = r - 1
	if s >= 2:
		print('YES')
	elif s == 1 and r > 1:
		print('YES')
	else:
		print('NO')


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from collections import Counter
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
count = [0] * (10 ** 5 + 2)
countofcount = [0] * (10 ** 5 + 2)
for i in arr:
	count[i] += 1
	countofcount[count[i]] += 1
for ii in range(q):
	(sign, val) = map(str, input().split())
	val = int(val)
	if sign == '-':
		countofcount[count[val]] -= 1
		count[val] -= 1
	else:
		count[val] += 1
		countofcount[count[val]] += 1
	if countofcount[2] > 1 and countofcount[6] > 0 or countofcount[4] > 1 or (countofcount[4] > 0 and countofcount[2] > 2) or (countofcount[8] > 0):
		print('YES')
	else:
		print('NO')


from sys import stdin, exit
from bisect import bisect_left as bl, bisect_right as br
input = lambda : stdin.readline()[:-1]
intput = lambda : int(input())
sinput = lambda : input().split()
intsput = lambda : map(int, sinput())

def dprint(*args, **kwargs):
	if debugging:
		print(*args, **kwargs)
debugging = 1
plank_count = [0] * (10 ** 5 + 10)
n = intput()
a = intsput()
for plank in a:
	plank_count[plank] += 1
largest = set()
medium = set()
for (length, count) in enumerate(plank_count):
	if count >= 4:
		largest.add(length)
	elif count >= 2:
		medium.add(length)
q = intput()
for i in range(q):
	(t, l) = sinput()
	l = int(l)
	if t == '+':
		plank_count[l] += 1
		if plank_count[l] == 4:
			medium.remove(l)
			largest.add(l)
		elif plank_count[l] == 2:
			medium.add(l)
	elif t == '-':
		plank_count[l] -= 1
		if plank_count[l] == 3:
			largest.remove(l)
			medium.add(l)
		elif plank_count[l] == 1:
			medium.remove(l)
	square = len(largest) > 0
	rectangle = len(medium) >= 2 or len(largest) >= 2 or (len(largest) and plank_count[next(iter(largest))] >= 6 and len(medium)) or (len(largest) and plank_count[next(iter(largest))] >= 8)
	if square and rectangle:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = defaultdict(int)
d2 = defaultdict(int)
for i in a:
	d[i] += 1
for i in d.values():
	if i >= 4 and i < 6:
		d2[4] += 1
	elif i >= 2 and i < 4:
		d2[2] += 1
	elif i >= 6 and i < 8:
		d2[6] += 1
	elif i >= 8:
		d2[8] += 1
q = int(input())
while q:
	q = q - 1
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		temp = d[x]
		d[x] += 1
		if temp == 3:
			d2[2] -= 1
			d2[4] += 1
		elif temp == 7:
			d2[6] -= 1
			d2[8] += 1
		elif temp == 1:
			d2[2] += 1
		elif temp == 5:
			d2[6] += 1
			d2[4] -= 1
	else:
		temp = d[x]
		d[x] -= 1
		if temp == 4:
			d2[4] -= 1
			d2[2] += 1
		elif temp == 8:
			d2[8] -= 1
			d2[6] += 1
		elif temp == 2:
			d2[2] -= 1
		elif temp == 6:
			d2[6] -= 1
			d2[4] += 1
	if d2[4] >= 1 and d2[2] >= 2 or (d2[6] >= 1 and d2[2] >= 1) or d2[8] >= 1 or (d2[4] >= 2) or (d2[6] >= 1 and d2[4] >= 1) or (d2[6] >= 2):
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
q = int(input())
dic = {}
set2 = set()
set4 = set()
rem = {}
rem2 = 0
numSq = 0
for i in range(n):
	if arr[i] in dic:
		dic[arr[i]] += 1
	else:
		dic[arr[i]] = 1
for key in dic.keys():
	if dic[key] >= 4:
		set4.add(key)
		numSq += dic[key] // 4
		if dic[key] % 4 in rem:
			rem[dic[key] % 4] += 1
		else:
			rem[dic[key] % 4] = 1
	elif dic[key] >= 2:
		set2.add(key)
		if dic[key] == 3:
			rem2 += 1
for i in range(q):
	inp = input()
	num = int(inp[1:])
	if inp[0] == '+':
		if num in dic:
			dic[num] += 1
		else:
			dic[num] = 1
	else:
		dic[num] -= 1
	if num in set2:
		if dic[num] == 2:
			rem2 -= 1
		elif dic[num] == 3:
			rem2 += 1
		elif dic[num] < 2:
			set2.remove(num)
		elif dic[num] > 3:
			set2.remove(num)
			set4.add(num)
			numSq += 1
			if 0 in rem:
				rem[0] += 1
			else:
				rem[0] = 1
	elif num in set4:
		if dic[num] < 4:
			numSq -= 1
			set4.remove(num)
			set2.add(num)
			rem2 += 1
		elif dic[num] % 4 == 0:
			if inp[0] == '+':
				rem[3] -= 1
				if 0 in rem:
					rem[0] += 1
				else:
					rem[0] = 1
				numSq += 1
			else:
				rem[1] -= 1
				if 0 in rem:
					rem[0] += 1
				else:
					rem[0] = 1
		elif inp[0] == '+':
			reqVal = dic[num] % 4 - 1
			if reqVal == -1:
				numSq += 1
				reqVal = 3
			rem[reqVal] -= 1
			if dic[num] % 4 in rem:
				rem[dic[num] % 4] += 1
			else:
				rem[dic[num] % 4] = 1
		else:
			reqVal = dic[num] % 4 + 1
			if reqVal == 4:
				numSq -= 1
				reqVal = 0
			rem[reqVal] -= 1
			if dic[num] % 4 in rem:
				rem[dic[num] % 4] += 1
			else:
				rem[dic[num] % 4] = 1
	elif dic[num] == 2:
		set2.add(num)
	if numSq == 0:
		print('NO')
	elif numSq == 1:
		if len(set2) == 0:
			print('NO')
		elif len(set2) == 1:
			if 2 in rem and rem[2] >= 1 or (3 in rem and rem[3] >= 1):
				print('YES')
			else:
				print('NO')
		else:
			print('YES')
	else:
		print('YES')


from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop

def check(t, f, s, e):
	if len(e) > 0:
		return 'YES'
	if len(s) > 1 or len(f) > 1:
		return 'YES'
	if len(s) == 1 and len(t) > 1:
		return 'YES'
	if len(f) == 1 and len(t) > 2:
		return 'YES'
	return 'NO'

def func(I, Q):
	temp = []
	(four, two, six, eight) = (Counter(temp), Counter(temp), Counter(temp), Counter(temp))
	for i in I:
		if I[i] > 1:
			two[i] += 1
		if I[i] > 3:
			four[i] += 1
		if I[i] > 5:
			six[i] += 1
		if I[i] > 7:
			eight[i] += 1
	for i in Q:
		(s, n) = (i[0], int(i[1]))
		if s == '+':
			I[n] += 1
			if I[n] == 2:
				two[n] += 1
			elif I[n] == 4:
				four[n] += 1
			elif I[n] == 6:
				six[n] += 1
			elif I[n] == 8:
				eight[n] += 1
		else:
			I[n] -= 1
			if I[n] == 7:
				del eight[n]
			elif I[n] == 5:
				del six[n]
			elif I[n] == 3:
				del four[n]
			elif I[n] == 1:
				del two[n]
		print(check(two, four, six, eight))
n = int(input())
I = list(map(int, input().split()))
hash = Counter(I)
p = int(input())
Q = []
for i in range(p):
	Q.append(list(input().split()))
func(hash, Q)


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import defaultdict
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	n = II()
	li = L()
	freq = [0] * (10 ** 5 + 1)
	grp_cnt = [0] * (10 ** 5 + 1)
	for ele in li:
		freq[ele] += 1
		grp_cnt[freq[ele]] += 1
	m = II()
	for i in range(m):
		(x, v) = input().split()
		v = int(v)
		if x == '+':
			freq[v] += 1
			grp_cnt[freq[v]] += 1
		else:
			grp_cnt[freq[v]] -= 1
			freq[v] -= 1
		if grp_cnt[8] > 0:
			P('YES')
		elif grp_cnt[4] >= 2:
			P('YES')
		elif grp_cnt[6] > 0 and grp_cnt[2] > 1:
			P('YES')
		elif grp_cnt[4] > 0 and grp_cnt[2] > 2:
			P('YES')
		else:
			P('NO')
	return
t = 1
for i in range(t):
	solve()


n = int(input())
a = list(map(int, input().split()))
planks = [0] * (10 ** 5 + 1)
for i in a:
	planks[i] += 1
q = int(input())
c2 = 0
c4 = 0
for i in range(len(planks)):
	c2 += planks[i] // 2
	c4 += planks[i] // 4
for _ in range(q):
	(c, d) = map(str, input().split())
	c2 -= planks[int(d)] // 2
	c4 -= planks[int(d)] // 4
	if c == '-':
		planks[int(d)] -= 1
	else:
		planks[int(d)] += 1
	c2 += planks[int(d)] // 2
	c4 += planks[int(d)] // 4
	if c2 >= 4 and c4 >= 1:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
d = {}
for itr in a:
	if itr in d:
		d[itr] += 1
	else:
		d[itr] = 1
x = {2: 0, 4: 0, 6: 0, 8: 0}
for itr in d:
	if d[itr] >= 8:
		x[8] += 1
	elif d[itr] >= 6:
		x[6] += 1
	elif d[itr] >= 4:
		x[4] += 1
	elif d[itr] >= 2:
		x[2] += 1
for itr in range(m):
	b = list(input().split())
	k = int(b[1])
	if b[0] == '+':
		if k in d:
			d[k] += 1
		else:
			d[k] = 1
		if d[k] == 8:
			x[8] += 1
			x[6] -= 1
		elif d[k] == 6:
			x[6] += 1
			x[4] -= 1
		elif d[k] == 4:
			x[4] += 1
			x[2] -= 1
		elif d[k] == 2:
			x[2] += 1
	else:
		d[k] -= 1
		if d[k] == 7:
			x[8] -= 1
			x[6] += 1
		elif d[k] == 5:
			x[6] -= 1
			x[4] += 1
		elif d[k] == 3:
			x[4] -= 1
			x[2] += 1
		elif d[k] == 1:
			x[2] -= 1
	if x[8] >= 1:
		print('YES')
	elif x[6] >= 2:
		print('YES')
	elif x[6] >= 1 and x[4] + x[2] >= 1:
		print('YES')
	elif x[4] >= 2:
		print('YES')
	elif x[4] >= 1 and x[2] >= 2:
		print('YES')
	else:
		print('NO')


num = int(input())
plank_list = list(map(int, input().split(' ')))
operation = int(input())
cnt4 = 0
cnt2 = 0
plank_dict = [0] * 100001
for i in plank_list:
	plank_dict[i] += 1
for i in plank_dict:
	cnt4 += i // 4
	cnt2 += i // 2
for i in range(operation):
	(a, b) = input().split(' ')
	b = int(b)
	if a == '+':
		cnt4 -= plank_dict[b] // 4
		cnt2 -= plank_dict[b] // 2
		plank_dict[b] += 1
		cnt4 += plank_dict[b] // 4
		cnt2 += plank_dict[b] // 2
	else:
		cnt4 -= plank_dict[b] // 4
		cnt2 -= plank_dict[b] // 2
		plank_dict[b] -= 1
		cnt4 += plank_dict[b] // 4
		cnt2 += plank_dict[b] // 2
	if cnt4 >= 1 and cnt2 >= 4:
		print('YES')
	else:
		print('NO')


import sys, os
from collections import Counter
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
input = lambda : sys.stdin.readline().strip()
li = lambda : list(map(int, input().split()))
I = lambda : int(input())
n = I()
l = li()
q = I()
d = Counter(l)
s2 = 0
s4 = 0
change = {}
for i in d:
	(s2c, s4c) = (0, 0)
	og = d[i]
	if d[i] >= 4:
		s4c += d[i] // 4
		d[i] = d[i] % 4
	if d[i] >= 2:
		s2c += d[i] // 2
		d[i] = d[i] // 2
	d[i] = og
	change[i] = [s2c, s4c]
	s2 += s2c
	s4 += s4c
for j in range(q):
	(sign, num) = input().split()
	i = int(num)
	if sign == '+':
		d[i] += 1
		(s2c, s4c) = (0, 0)
		og = d[i]
		if d[i] >= 4:
			s4c += d[i] // 4
			d[i] = d[i] % 4
		if d[i] >= 2:
			s2c += d[i] // 2
			d[i] = d[i] // 2
		d[i] = og
		s2 -= change.get(i, [0, 0])[0]
		s4 -= change.get(i, [0, 0])[1]
		change[i] = [s2c, s4c]
		s2 += s2c
		s4 += s4c
	else:
		d[i] -= 1
		(s2c, s4c) = (0, 0)
		og = d[i]
		if d[i] >= 4:
			s4c += d[i] // 4
			d[i] = d[i] % 4
		if d[i] >= 2:
			s2c += d[i] // 2
			d[i] = d[i] % 2
		d[i] = og
		s2 -= change.get(i, [0, 0])[0]
		s4 -= change.get(i, [0, 0])[1]
		change[i] = [s2c, s4c]
		s2 += s2c
		s4 += s4c
	if s2 > 1 and s4 > 0 or s4 > 1:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = [0 for i in range(10 ** 5)]
l = input().split()
li = [int(i) for i in l]
for i in li:
	arr[i - 1] += 1
rec = 0
square = 0
for i in arr:
	square += i // 4
	rec = rec + i % 4 // 2
q = int(input())
for you in range(q):
	s = input().split()
	x = s[0]
	y = int(s[1])
	if x == '-':
		z = arr[y - 1] // 4
		alp = arr[y - 1] % 4 // 2
		square -= z
		rec -= alp
		arr[y - 1] -= 1
		square += arr[y - 1] // 4
		rec = rec + arr[y - 1] % 4 // 2
	else:
		z = arr[y - 1] // 4
		alp = arr[y - 1] % 4 // 2
		square -= z
		rec -= alp
		arr[y - 1] += 1
		square += arr[y - 1] // 4
		rec = rec + arr[y - 1] % 4 // 2
	if square >= 2 or (square >= 1 and rec >= 2):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
d = dict()
(two, four, six, eig) = (0, 0, 0, 0)
for e in a:
	if e in d:
		d[e] += 1
		if d[e] == 2:
			two += 1
		elif d[e] == 4:
			four += 1
			two -= 1
		elif d[e] == 6:
			six += 1
			four -= 1
		elif d[e] == 8:
			eig += 1
			six -= 1
	else:
		d[e] = 1
Q = int(input())
q = []
for _ in range(Q):
	(inp, val) = map(str, input().split())
	val = int(val)
	if inp == '+':
		if val in d:
			d[val] += 1
			if d[val] == 2:
				two += 1
			elif d[val] == 4:
				four += 1
				two -= 1
			elif d[val] == 6:
				six += 1
				four -= 1
			elif d[val] == 8:
				eig += 1
				six -= 1
		else:
			d[val] = 1
	else:
		d[val] -= 1
		if d[val] == 1:
			two -= 1
		elif d[val] == 3:
			four -= 1
			two += 1
		elif d[val] == 5:
			six -= 1
			four += 1
		elif d[val] == 7:
			eig -= 1
			six += 1
	if eig > 0:
		print('YES')
	elif six > 0:
		if six > 1 or two > 0 or four > 0:
			print('YES')
		else:
			print('NO')
	elif four > 0:
		if four > 1:
			print('YES')
		elif two > 1:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
count = [0] * (10 ** 5 + 1)
fours = {}
twos = {}
for x in arr:
	count[x] += 1
	if count[x] >= 4:
		fours[x] = count[x]
		if x in twos:
			del twos[x]
	if 2 <= count[x] <= 3:
		twos[x] = count[x]
for i in range(int(input())):
	(query, length) = list(input().split())
	length = int(length)
	if query == '+':
		count[length] += 1
		if length in fours:
			fours[length] += 1
		elif length in twos:
			twos[length] += 1
			if twos[length] == 4:
				del twos[length]
				fours[length] = 4
		elif count[length] == 2:
			twos[length] = 2
	else:
		count[length] -= 1
		if length in fours:
			fours[length] -= 1
			if fours[length] < 4:
				del fours[length]
				twos[length] = count[length]
		elif length in twos:
			twos[length] -= 1
			if twos[length] < 2:
				del twos[length]
	temp1 = 0
	temp2 = 0
	for k in fours:
		temp1 += fours[k] // 4
		temp2 += fours[k] % 4 // 2
		if temp1 > 1 or (temp1 >= 1 and temp2 >= 2):
			break
	temp2 += len(twos)
	if temp1 > 1 or (temp1 >= 1 and temp2 >= 2):
		print('YES')
	else:
		print('NO')


def main():
	n = int(input())
	a = list(map(int, input().split()))
	l = [0 for i in range(100001)]
	for i in range(n):
		l[a[i]] += 1
	m2 = set([])
	m4 = set([])
	m6 = set([])
	m8 = set([])
	for i in range(100001):
		if l[i] == 2 or l[i] == 3:
			m2.add(i)
		if l[i] == 4 or l[i] == 5:
			m4.add(i)
		if l[i] == 6 or l[i] == 7:
			m6.add(i)
		if l[i] >= 8:
			m8.add(i)
	q = int(input())
	for i in range(q):
		(s, idx) = input().split()
		idx = int(idx)
		if s == '+':
			l[idx] += 1
			if l[idx] == 2:
				m2.add(idx)
			elif idx in m2 and l[idx] == 4:
				m2.discard(idx)
				m4.add(idx)
			elif idx in m4 and l[idx] == 6:
				m4.discard(idx)
				m6.add(idx)
			elif idx in m6 and l[idx] == 8:
				m6.discard(idx)
				m8.add(idx)
		else:
			l[idx] -= 1
			if idx in m2 and l[idx] == 1:
				m2.discard(idx)
			elif idx in m4 and l[idx] == 3:
				m4.discard(idx)
				m2.add(idx)
			elif idx in m6 and l[idx] == 5:
				m6.discard(idx)
				m4.add(idx)
			elif idx in m8 and l[idx] == 7:
				m8.discard(idx)
				m6.add(idx)
		if len(m8) > 0 or len(m6) > 1 or (len(m6) > 0 and len(m2) + len(m4) > 0) or (len(m4) > 1) or (len(m4) > 0 and len(m2) > 1):
			print('YES')
		else:
			print('NO')
main()


from collections import defaultdict
t = int(input())
ps = list(map(int, input().split()))
q = int(input())
store = defaultdict(lambda : 0)
for p in ps:
	store[p] += 1
(twos, fors) = (0, 0)
for k in store.keys():
	if store[k] >= 2:
		twos += store[k] // 2
	if store[k] >= 4:
		fors += store[k] // 4
for i in range(q):
	c = input().split()
	val = int(c[1])
	before = store[val]
	if c[0] == '+':
		store[val] += 1
	elif c[0] == '-':
		store[val] -= 1
	twos += store[val] // 2 - before // 2
	fors += store[val] // 4 - before // 4
	if fors >= 2 or (fors >= 1 and twos >= 4):
		print('YES')
	else:
		print('NO')


t = int(input())

def calculate(main):
	if main.get(8, 0) >= 1:
		print('YES')
	elif main.get(4, 0) >= 2:
		print('YES')
	elif main.get(6, 0) >= 2:
		print('YES')
	elif main.get(6, 0) == 1 and (main.get(4, 0) >= 1 or main.get(2, 0) >= 1):
		print('YES')
	elif main.get(4, 0) == 1 and main.get(2, 0) >= 2:
		print('YES')
	else:
		print('NO')
a = list(map(lambda x: int(x), input().split()))
hashmap = {}
main = {2: 0, 4: 0, 8: 0, 6: 0}
for i in a:
	if i not in hashmap:
		hashmap[i] = 0
	hashmap[i] += 1
for i in hashmap:
	if hashmap[i] >= 8:
		main[8] += 1
	elif hashmap[i] >= 6:
		main[6] += 1
	elif hashmap[i] >= 4:
		main[4] += 1
	elif hashmap[i] >= 2:
		main[2] += 1
q = int(input())
for i in range(0, q):
	(op, num) = list(map(lambda x: x, input().split()))
	num = int(num)
	if op == '+':
		if num not in hashmap:
			hashmap[num] = 1
			calculate(main)
			continue
		temp = hashmap[num]
		hashmap[num] += 1
		if hashmap[num] == 2:
			main[2] += 1
		elif hashmap[num] == 4:
			main[2] -= 1
			main[4] += 1
		elif hashmap[num] == 6:
			main[4] -= 1
			main[6] += 1
		elif hashmap[num] == 8:
			main[6] -= 1
			main[8] += 1
	if op == '-':
		if num not in hashmap:
			hashmap[num] = 1
			calculate(main)
			continue
		temp = hashmap[num]
		hashmap[num] -= 1
		if temp == 2:
			main[2] -= 1
		elif temp == 4:
			main[2] += 1
			main[4] -= 1
		elif temp == 6:
			main[6] -= 1
			main[4] += 1
		elif temp == 8:
			main[6] += 1
			main[8] -= 1
	calculate(main)


import sys
input = sys.stdin.readline
n = int(input())
L = [*map(int, input().split())]
q = int(input())
events = []
for _ in range(q):
	(sym, num) = input().rstrip().split()
	events.append([sym, int(num)])
L_dict = {}
for l in L:
	try:
		L_dict[l] += 1
	except KeyError:
		L_dict[l] = 1
(double, quatro) = (0, 0)
for (lth, cnt) in L_dict.items():
	q_made = cnt // 4
	d_made = cnt % 4 // 2
	quatro += q_made
	double += d_made
	L_dict[lth] = [cnt, q_made, d_made]
for (sym, num) in events:
	if sym == '+':
		try:
			L_dict[num][0] += 1
			if L_dict[num][0] // 4 > L_dict[num][1]:
				L_dict[num][1] += 1
				L_dict[num][2] = 0
				quatro += 1
				double -= 1
			elif L_dict[num][0] % 4 // 2 > L_dict[num][2]:
				L_dict[num][2] += 1
				double += 1
		except KeyError:
			L_dict[num] = [1, 0, 0]
	else:
		L_dict[num][0] = max(0, L_dict[num][0] - 1)
		if L_dict[num][0] // 4 < L_dict[num][1]:
			L_dict[num][1] -= 1
			L_dict[num][2] += 1
			quatro -= 1
			double += 1
		elif L_dict[num][0] % 4 // 2 < L_dict[num][2]:
			L_dict[num][2] -= 1
			double -= 1
	if quatro >= 2 or (quatro >= 1 and double >= 2):
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
two = set()
four = set()
six = set()
eight = set()
d = defaultdict(int)
for i in range(n):
	d[a[i]] += 1
for (i, m) in d.items():
	if m >= 8:
		eight.add(i)
	elif m >= 6:
		six.add(i)
	elif m >= 4:
		four.add(i)
	elif m >= 2:
		two.add(i)
q = int(input())
for i in range(q):
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		d[x] += 1
		if d[x] == 8:
			eight.add(x)
			six.remove(x)
		elif d[x] == 6:
			six.add(x)
			four.remove(x)
		elif d[x] == 4:
			four.add(x)
			two.remove(x)
		elif d[x] == 2:
			two.add(x)
	else:
		if d[x] == 8:
			eight.remove(x)
			six.add(x)
		elif d[x] == 6:
			six.remove(x)
			four.add(x)
		elif d[x] == 4:
			four.remove(x)
			two.add(x)
		elif d[x] == 2:
			two.remove(x)
		d[x] -= 1
	if len(eight) >= 1:
		print('YES')
	elif len(six) >= 1 and (len(four) >= 1 or len(two) >= 1):
		print('YES')
	elif len(six) >= 2 or len(four) >= 2:
		print('YES')
	elif len(four) >= 1 and len(two) >= 2:
		print('YES')
	else:
		print('NO')


n = int(input(''))
p = [int(x) for x in input('').split()]
q = int(input(''))
l = [0] * 10 ** 6
(c2, c4, c6, c8) = (0, 0, 0, 0)
for i in p:
	l[i] += 1
	if l[i] == 2:
		c2 += 1
	elif l[i] == 4:
		c4 += 1
	elif l[i] == 6:
		c6 += 1
	elif l[i] == 8:
		c8 += 1
for i in range(q):
	qs = input('').split()
	if qs[0] == '+':
		l[int(qs[1])] += 1
		if l[int(qs[1])] == 2:
			c2 += 1
		elif l[int(qs[1])] == 4:
			c4 += 1
		elif l[int(qs[1])] == 6:
			c6 += 1
		elif l[int(qs[1])] == 8:
			c8 += 1
	else:
		l[int(qs[1])] -= 1
		if l[int(qs[1])] == 1:
			c2 -= 1
		elif l[int(qs[1])] == 3:
			c4 -= 1
		elif l[int(qs[1])] == 5:
			c6 -= 1
		elif l[int(qs[1])] == 7:
			c8 -= 1
	if c8 >= 1 or (c6 >= 1 and c2 >= 2) or c4 >= 2 or (c4 >= 1 and c2 >= 3):
		print('YES')
	else:
		print('NO')


import sys
I = [0 for i in range(10 ** 5 + 1)]
(y2, y4, y6, y8) = (0, 0, 0, 0)
n = int(sys.stdin.readline().strip())
a = list(map(int, sys.stdin.readline().strip().split()))
for i in range(0, n):
	I[a[i]] = I[a[i]] + 1
	if I[a[i]] == 2:
		y2 = y2 + 1
	if I[a[i]] == 4:
		y4 = y4 + 1
	if I[a[i]] == 6:
		y6 = y6 + 1
	if I[a[i]] == 8:
		y8 = y8 + 1
Q = int(sys.stdin.readline().strip())
for q in range(Q):
	(s, x) = sys.stdin.readline().strip().split()
	x = int(x)
	if s == '+':
		I[x] = I[x] + 1
		if I[x] == 2:
			y2 = y2 + 1
		if I[x] == 4:
			y4 = y4 + 1
		if I[x] == 6:
			y6 = y6 + 1
		if I[x] == 8:
			y8 = y8 + 1
	if s == '-':
		I[x] = I[x] - 1
		if I[x] == 1:
			y2 = y2 - 1
		if I[x] == 3:
			y4 = y4 - 1
		if I[x] == 5:
			y6 = y6 - 1
		if I[x] == 7:
			y8 = y8 - 1
	if y4 >= 1 and y2 + y4 + y6 + y8 >= 4:
		print('YES')
	else:
		print('NO')


from collections import *
n = int(input())
arr = [int(x) for x in input().split()]
c = Counter(arr)
f = 0
t = 0
for key in c:
	f += c[key] // 4
	t += c[key] % 4 // 2
q = int(input())
while q:
	q -= 1
	s = input()
	if s[0] == '+':
		add = int(s[2:])
		f -= c[add] // 4
		t -= c[add] % 4 // 2
		c[add] += 1
		f += c[add] // 4
		t += c[add] % 4 // 2
	else:
		sub = int(s[2:])
		f -= c[sub] // 4
		t -= c[sub] % 4 // 2
		c[sub] -= 1
		f += c[sub] // 4
		t += c[sub] % 4 // 2
	if f >= 2:
		print('YES')
	elif f == 1:
		if t >= 2:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


n = int(input())
lst = list(map(int, input().split()))
lenCnt = {}
(cnt, items) = ([], [])
if lst[0] == 80140:
	hack = True
for i in lst:
	if lenCnt.get(i):
		lenCnt[i] += 1
	else:
		lenCnt[i] = 1
		items.append(i)
(cnt2, cnt4) = (0, 0)
for i in items:
	if lenCnt[i] >= 4:
		cnt4 += lenCnt[i] // 4
		if lenCnt[i] % 4 >= 2:
			cnt2 += 1
	elif lenCnt[i] >= 2:
		cnt2 += 1
q = int(input())
for _ in range(q):
	val = input()
	m = int(val[1:])
	if val[0] == '+':
		if lenCnt.get(m) == None:
			lenCnt[m] = 0
		elif lenCnt[m] % 4 == 3:
			cnt2 -= 1
			cnt4 += 1
		elif lenCnt[m] % 4 == 1:
			cnt2 += 1
		lenCnt[m] += 1
	else:
		if lenCnt[m] % 4 == 0:
			cnt4 -= 1
			cnt2 += 1
		elif lenCnt[m] % 4 == 2:
			cnt2 -= 1
		lenCnt[m] -= 1
	if cnt4 >= 2:
		print('YES')
	elif cnt4 == 1 and cnt2 >= 2:
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
q = int(input())
C = Counter(A)
EIGHT = 0
SIX = 0
FOUR = 0
TWO = 0
for c in C:
	if C[c] >= 8:
		EIGHT += 1
	if C[c] >= 6:
		SIX += 1
	if C[c] >= 4:
		FOUR += 1
	if C[c] >= 2:
		TWO += 1
for i in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		C[y] += 1
		if C[y] == 8:
			EIGHT += 1
		elif C[y] == 6:
			SIX += 1
		elif C[y] == 4:
			FOUR += 1
		elif C[y] == 2:
			TWO += 1
	else:
		C[y] -= 1
		if C[y] == 7:
			EIGHT -= 1
		elif C[y] == 5:
			SIX -= 1
		elif C[y] == 3:
			FOUR -= 1
		elif C[y] == 1:
			TWO -= 1
	if EIGHT >= 1 or (SIX >= 1 and TWO >= 2) or FOUR >= 2 or (FOUR >= 1 and TWO >= 3):
		print('YES')
	else:
		print('NO')


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_l(tp):
	return list(r_t(tp))

def update(A, B, C, addition, x):
	if not addition:
		(in_4, in_2) = (x in B, x in C)
		new_val = A[x] - 1
		if new_val < 4 and in_4:
			del B[x]
		elif in_4:
			B[x] -= 1
		if new_val < 2 and in_2:
			del C[x]
		elif in_2:
			C[x] -= 1
		A[x] -= 1
	elif x in A:
		A[x] += 1
		if A[x] >= 4:
			B[x] = A[x]
		if A[x] >= 2:
			C[x] = A[x]
	else:
		A[x] = 1

def decide(A, B, C):
	ans = 'NO'
	if B:
		key = int()
		for k in B:
			key = k
			break
		update(A, B, C, 0, key)
		update(A, B, C, 0, key)
		update(A, B, C, 0, key)
		update(A, B, C, 0, key)
		if C:
			key1 = int()
			for k in C:
				key1 = k
				break
			update(A, B, C, 0, key1)
			update(A, B, C, 0, key1)
			if C:
				ans = 'YES'
			update(A, B, C, 1, key1)
			update(A, B, C, 1, key1)
		update(A, B, C, 1, key)
		update(A, B, C, 1, key)
		update(A, B, C, 1, key)
		update(A, B, C, 1, key)
	return ans

def main():
	n = int(r())
	nums = r_l(int)
	A = dict()
	for x in nums:
		if x not in A:
			A[x] = 1
		else:
			A[x] += 1
	(B, C) = (dict(), dict())
	for x in A:
		if A[x] >= 4:
			B[x] = A[x]
		if A[x] >= 2:
			C[x] = A[x]
	q = int(r())
	for _ in range(q):
		(addition, x) = r().split()
		x = int(x)
		update(A, B, C, 1 if addition == '+' else 0, x)
		print(decide(A, B, C))
main()


from collections import Counter
n = int(input())
a = list(map(int, input().split()))
a = Counter(a)
q = int(input())
tCT = 0
fCT = 0
for key in a:
	num = a[key] // 4
	fCT += num
	tCT += (a[key] - num * 4) // 2
for __ in range(q):
	x = input()
	v = int(x[2:])
	k = a[v] // 4
	fCTbe = k
	tCTbe = (a[v] - k * 4) // 2
	if x[0] == '+':
		a[v] += 1
	else:
		a[v] -= 1
	k_2 = a[v] // 4
	fCTaf = k_2
	tCTaf = (a[v] - k_2 * 4) // 2
	fCT += fCTaf - fCTbe
	tCT += tCTaf - tCTbe
	if fCT >= 2 or (fCT >= 1 and tCT >= 2):
		print('YES')
	else:
		print('NO')


from collections import Counter, defaultdict
from sys import stdin, stdout
input = stdin.readline
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
n = I()
a = LI()
di = defaultdict(int)
di = Counter(a)
(a, b, c, d) = (0, 0, 0, 0)
for i in di.keys():
	if di[i] >= 2 and di[i] <= 3:
		a += 1
	elif di[i] >= 4 and di[i] <= 5:
		b += 1
	elif di[i] >= 6 and di[i] <= 7:
		c += 1
	elif di[i] >= 8:
		d += 1
for _ in range(I()):
	f = input()
	g = int(f[2:])
	if f[0] == '+':
		di[g] += 1
		ans = di[g]
		if ans == 2:
			a += 1
		elif ans == 4:
			b += 1
			a -= 1
		elif ans == 6:
			c += 1
			b -= 1
		elif ans == 8:
			d += 1
			c -= 1
	if f[0] == '-':
		di[g] -= 1
		ans = di[g]
		if ans == 1:
			a -= 1
		elif ans == 3:
			a += 1
			b -= 1
		elif ans == 5:
			b += 1
			c -= 1
		elif ans == 7:
			c += 1
			d -= 1
	if b >= 2 or c >= 2 or d >= 1:
		print('YES')
	elif a >= 2 and b >= 1:
		print('YES')
	elif c >= 1 and a >= 1:
		print('YES')
	elif c >= 1 and b >= 1:
		print('YES')
	else:
		print('NO')


n = int(input())
a = False
lengths = input().split()
length_count = {}
number_of_2 = 0
number_of_4 = 0
number_of_6 = 0
number_of_8 = 0
for l in lengths:
	if l in length_count:
		length_count[l] += 1
		if length_count[l] == 8:
			number_of_8 += 1
			number_of_6 -= 1
		if length_count[l] == 6:
			number_of_6 += 1
			number_of_4 -= 1
		if length_count[l] == 4:
			number_of_4 += 1
			number_of_2 -= 1
		if length_count[l] == 2:
			number_of_2 += 1
	else:
		length_count[l] = 1
for _ in range(int(input())):
	(x, l) = input().split()
	if x == '+':
		if l in length_count:
			length_count[l] += 1
			if length_count[l] == 8:
				number_of_8 += 1
				number_of_6 -= 1
			if length_count[l] == 6:
				number_of_6 += 1
				number_of_4 -= 1
			if length_count[l] == 4:
				number_of_4 += 1
				number_of_2 -= 1
			if length_count[l] == 2:
				number_of_2 += 1
		else:
			length_count[l] = 1
	else:
		if length_count[l] == 8:
			number_of_8 -= 1
			number_of_6 += 1
		if length_count[l] == 6:
			number_of_6 -= 1
			number_of_4 += 1
		if length_count[l] == 4:
			number_of_4 -= 1
			number_of_2 += 1
		if length_count[l] == 2:
			number_of_2 -= 1
		length_count[l] -= 1
	if number_of_8 >= 1:
		print('YES')
	elif number_of_6 >= 1 and number_of_6 + number_of_2 + number_of_4 >= 2:
		print('YES')
	elif number_of_4 >= 2:
		print('YES')
	elif number_of_4 >= 1 and number_of_2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
li = list(map(int, input().split()))
sum2 = 0
sum4 = 0
val = int(pow(10, 5) + 1)
ans = [0] * val
for i in range(n):
	ans[li[i]] += 1
for i in range(1, val):
	sum2 += ans[i] // 2
	sum4 += ans[i] // 4
q = int(input())
for i in range(q):
	case = list(input().split())
	if case[0] == '+':
		sum4 -= ans[int(case[1])] // 4
		sum2 -= ans[int(case[1])] // 2
		ans[int(case[1])] += 1
		sum2 += ans[int(case[1])] // 2
		sum4 += ans[int(case[1])] // 4
	else:
		sum4 -= ans[int(case[1])] // 4
		sum2 -= ans[int(case[1])] // 2
		ans[int(case[1])] -= 1
		sum2 += ans[int(case[1])] // 2
		sum4 += ans[int(case[1])] // 4
	print('YES' if sum4 >= 1 and sum2 >= 4 else 'NO')


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	loglen = [0] * 100009
	for _ in range(1):
		n = ri()
		a = ria()
		q = ri()
		for i in a:
			loglen[i] += 1
		n2 = 0
		n4 = 0
		n6 = 0
		n8 = 0
		for i in loglen:
			if i >= 2:
				n2 += 1
			if i >= 4:
				n4 += 1
			if i >= 6:
				n6 += 1
			if i >= 8:
				n8 += 1
		for i in range(q):
			ans = 'NO'
			(s, x) = input().split()
			x = int(x)
			if s == '+':
				if loglen[x] == 1:
					n2 += 1
				if loglen[x] == 3:
					n4 += 1
				if loglen[x] == 5:
					n6 += 1
				if loglen[x] == 7:
					n8 += 1
				loglen[x] += 1
			else:
				if loglen[x] == 2:
					n2 -= 1
				if loglen[x] == 4:
					n4 -= 1
				if loglen[x] == 6:
					n6 -= 1
				if loglen[x] == 8:
					n8 -= 1
				loglen[x] -= 1
			if n8 >= 1:
				ans = 'YES'
			if n6 >= 1 and n2 >= 2:
				ans = 'YES'
			if n4 >= 2:
				ans = 'YES'
			if n4 >= 1 and n2 >= 3:
				ans = 'YES'
			print(ans)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


t = int(input())
arr = [int(item) for item in input().split()]
d = dict()
for i in range(10 ** 5 + 1):
	d[i] = 0
for i in arr:
	d[i] = d[i] + 1
count2 = 0
count4 = 0
count6 = 0
count8 = 0
for j in d:
	if d[j] == 2 or d[j] == 3:
		count2 = count2 + 1
	if d[j] == 4 or d[j] == 5:
		count4 = count4 + 1
	if d[j] == 6 or d[j] == 7:
		count6 = count6 + 1
	if d[j] == 8 or d[j] > 8:
		count8 = count8 + 1
for i in range(int(input())):
	brr = [item for item in input().split()]
	a = brr[0]
	b = int(brr[1])
	if a == '+':
		start = d[b]
		d[b] = d[b] + 1
		if start == 1:
			count2 = count2 + 1
		if start == 3:
			count4 = count4 + 1
			count2 = count2 - 1
		if start == 5:
			count6 = count6 + 1
			count4 = count4 - 1
		if start == 7:
			count8 = count8 + 1
			count6 = count6 - 1
	if a == '-':
		start = d[b]
		d[b] = d[b] - 1
		if start == 2:
			count2 = count2 - 1
		if start == 4:
			count4 = count4 - 1
			count2 = count2 + 1
		if start == 6:
			count6 = count6 - 1
			count4 = count4 + 1
		if start == 8:
			count8 = count8 - 1
			count6 = count6 + 1
	flag = 0
	if count8 > 0:
		print('YES')
		flag = 1
	if count6 > 0 and (count2 > 0 or count4 > 0 or count6 - 1 > 0) and (flag == 0):
		print('YES')
		flag = 1
	if count4 - 1 > 0 and flag == 0:
		print('YES')
		flag = 1
	if count4 > 0 and count2 > 1 and (flag == 0):
		print('YES')
		flag = 1
	if flag == 0:
		print('NO')


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
n = int(input())
a = list(map(int, input().split()))
pairs = {}
single = set()
sq = {}
for j in a:
	if j in single:
		single.remove(j)
		pairs[j] = pairs.get(j, 0) + 1
		if pairs[j] == 2:
			sq[j] = sq.get(j, 0) + 1
			del pairs[j]
	else:
		single.add(j)
q = int(input())
for i in range(q):
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		if x in single:
			single.remove(x)
			pairs[x] = pairs.get(x, 0) + 1
			if pairs[x] == 2:
				sq[x] = sq.get(x, 0) + 1
				del pairs[x]
		else:
			single.add(x)
	elif x in single:
		single.remove(x)
	else:
		single.add(x)
		if pairs.get(x) != None:
			pairs[x] -= 1
			if pairs[x] == 0:
				del pairs[x]
		else:
			sq[x] -= 1
			if sq[x] == 0:
				del sq[x]
			pairs[x] = pairs.get(x, 0) + 1
	if len(sq) == 0:
		print('NO')
		continue
	ans = 0
	for j in sq:
		ans += sq[j]
		if ans >= 2:
			print('YES')
			break
	else:
		ans = 0
		for j in pairs:
			ans += pairs[j]
			if ans >= 2:
				print('YES')
				break
		else:
			print('NO')


import sys
ii = lambda : sys.stdin.readline().strip()
idata = lambda : [int(x) for x in ii().split()]

def main():
	n = int(ii())
	data = idata()
	slov = {}
	(sum2, sum4) = (0, 0)
	for i in range(n):
		slov[data[i]] = 1 if data[i] not in slov else slov[data[i]] + 1
		if slov[data[i]] % 2 == 0:
			sum2 += 1
		if slov[data[i]] % 4 == 0:
			sum4 += 1
	for i in range(int(ii())):
		d = input().split()
		if d[0] == '+':
			slov[int(d[1])] = 1 if int(d[1]) not in slov else slov[int(d[1])] + 1
			if slov[int(d[1])] % 2 == 0:
				sum2 += 1
			if slov[int(d[1])] % 4 == 0:
				sum4 += 1
		else:
			slov[int(d[1])] -= 1
			if slov[int(d[1])] % 2 == 1:
				sum2 -= 1
			if slov[int(d[1])] % 4 == 3:
				sum4 -= 1
		if sum2 > 3 and sum4 > 0:
			print('YES')
		else:
			print('NO')
main()


from collections import Counter
import sys
input = sys.stdin.readline
N = int(input())
A = [int(_) for _ in input().split()]
cc = Counter(A)
nb4 = 0
nb2 = 0
nb6 = 0
nb8 = 0
for (k, count) in cc.items():
	if count >= 8:
		nb8 += 1
	if count >= 6:
		nb6 += 1
	if count >= 4:
		nb4 += 1
	if count >= 2:
		nb2 += 1
Q = int(input())
for i in range(Q):
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		cc[x] += 1
		if cc[x] == 2:
			nb2 += 1
		if cc[x] == 4:
			nb4 += 1
		if cc[x] == 6:
			nb6 += 1
		if cc[x] == 8:
			nb8 += 1
	else:
		cc[x] -= 1
		if cc[x] == 1:
			nb2 -= 1
		if cc[x] == 3:
			nb4 -= 1
		if cc[x] == 5:
			nb6 -= 1
		if cc[x] == 7:
			nb8 -= 1
	if nb4 > 1:
		print('YES')
	elif nb4 == 0:
		print('NO')
	elif nb2 > 2:
		print('YES')
	elif nb2 == 2:
		if nb6 >= 1:
			print('YES')
		else:
			print('NO')
	elif nb2 == 1:
		if nb8 >= 1:
			print('YES')
		else:
			print('NO')


from collections import Counter
n = int(input())
l = list(map(int, input().split()))
q = int(input())
cc = Counter(l)
(c2, c4, c6, c8) = (0, 0, 0, 0)
for i in cc.values():
	if i >= 8:
		c8 += 1
	elif 6 <= i < 8:
		c6 += 1
	elif 4 <= i < 6:
		c4 += 1
	elif 2 <= i < 4:
		c2 += 1
for xi in range(q):
	(e, p) = input().split()
	p = int(p)
	if e == '+':
		if p in cc:
			cc[p] += 1
			if cc[p] == 8:
				c8 += 1
				c6 -= 1
			elif cc[p] == 6:
				c6 += 1
				c4 -= 1
			elif cc[p] == 4:
				c4 += 1
				c2 -= 1
			elif cc[p] == 2:
				c2 += 1
		else:
			cc[p] = 1
	else:
		cc[p] -= 1
		if cc[p] == 7:
			c8 -= 1
			c6 += 1
		elif cc[p] == 5:
			c6 -= 1
			c4 += 1
		elif cc[p] == 3:
			c4 -= 1
			c2 += 1
		elif cc[p] == 1:
			c2 -= 1
	if c8 >= 1:
		print('YES')
	elif c6 >= 1 and (c4 >= 1 or c2 >= 1 or c8 >= 1):
		print('YES')
	elif c4 >= 2 or c6 >= 2 or c8 >= 2:
		print('YES')
	elif c4 >= 1 and c2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
arr = list(map(int, input().split()))
ware = {}
t = set()
f = set()
for i in range(n):
	ware[arr[i]] = ware.get(arr[i], 0) + 1
	if ware[arr[i]] == 4:
		f.add(arr[i])
		t.remove(arr[i])
	elif ware[arr[i]] == 2:
		t.add(arr[i])
q = int(input())
for _ in range(q):
	(s, a) = input().split()
	a = int(a)
	if s == '+':
		ware[a] = ware.get(a, 0) + 1
		if ware[a] == 4:
			f.add(a)
			t.remove(a)
		elif ware[a] == 2:
			t.add(a)
	else:
		if ware[a] == 4:
			f.remove(a)
			t.add(a)
		elif ware[a] == 2:
			t.remove(a)
		ware[a] -= 1
	if len(f) == 1:
		a = list(f)[0]
		if ware[a] >= 6:
			if ware[a] >= 8:
				print('YES')
			elif len(t) > 0:
				print('YES')
			else:
				print('NO')
		elif ware[a] >= 4:
			if len(t) < 2:
				print('NO')
			else:
				print('YES')
		else:
			print('NO')
	elif len(f) >= 2:
		print('YES')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def getans():
	if fof[2] >= 2 and fof[4] >= 1:
		return 'YES'
	else:
		rectangle = False
		square = False
		tfof = fof.copy()
		f1 = False
		f2 = False
		for i in range(2, 9):
			if not (f1 or f2):
				if tfof[i] >= 1:
					f1 = True
					tfof[i] -= 1
					tfof[i - 2] += 1
					break
		for i in range(2, 9):
			if tfof[i] >= 1:
				f2 = True
				tfof[i] -= 1
				tfof[i - 2] += 1
				break
		if f1 and f2:
			rectangle = True
		if rectangle:
			for i in range(4, 9):
				if tfof[i] >= 1:
					square = True
					break
		if square and rectangle:
			return 'YES'
		else:
			return 'NO'
n = int(input())
l = list(map(int, input().split()))
f = [0] * 100005
for i in l:
	f[i] += 1
fof = [0] * 9
for i in f:
	fof[min(8, i)] += 1
q = int(input())
for i in range(0, q):
	s = input().split()
	s[1] = int(s[1])
	if s[0] == '+':
		f[s[1]] += 1
		fof[min(8, f[s[1]])] += 1
		fof[min(8, f[s[1]] - 1)] -= 1
		print(getans())
	else:
		f[s[1]] -= 1
		fof[min(8, f[s[1]])] += 1
		fof[min(8, f[s[1]] + 1)] -= 1
		print(getans())


from collections import Counter
n = int(input())
c = Counter(input().split())
c4 = 0
c2 = 0
for x in c.values():
	(p, q) = divmod(x, 4)
	c4 += p
	c2 += q // 2
for _ in range(int(input())):
	(s, l) = input().split()
	x = c[l]
	(p, q) = divmod(x, 4)
	c4 -= p
	c2 -= q // 2
	q = 1 if s == '+' else -1
	x += q
	c[l] = x
	(p, q) = divmod(x, 4)
	c4 += p
	c2 += q // 2
	print('YES' if c4 > 1 or (c4 == 1 and c2 > 1) else 'NO')


import sys
N = int(sys.stdin.readline())
planks = [int(x) for x in sys.stdin.readline().split()]
storage = [0 for x in range(10 ** 5 + 1)]
for i in planks:
	storage[i] += 1
store2 = 0
store4 = 0
store6 = 0
store8 = 0
for i in storage:
	if i == 2 or i == 3:
		store2 += 1
	elif i == 4 or i == 5:
		store4 += 1
	elif i == 6 or i == 7:
		store6 += 1
	elif i >= 8:
		store8 += 1
for _ in range(int(input())):
	event = sys.stdin.readline().split()
	if event[0] == '+':
		if storage[int(event[1])] == 1:
			store2 += 1
		if storage[int(event[1])] == 3:
			store4 += 1
			store2 -= 1
		if storage[int(event[1])] == 5:
			store6 += 1
			store4 -= 1
		if storage[int(event[1])] == 7:
			store8 += 1
			store6 -= 1
		storage[int(event[1])] += 1
	else:
		if storage[int(event[1])] == 2:
			store2 -= 1
		if storage[int(event[1])] == 4:
			store4 -= 1
			store2 += 1
		if storage[int(event[1])] == 6:
			store6 -= 1
			store4 += 1
		if storage[int(event[1])] == 8:
			store8 -= 1
			store6 += 1
		storage[int(event[1])] -= 1
	if store2 >= 2 and store4 >= 1 or (store2 >= 1 and store6 >= 1) or store8 >= 1 or (store4 >= 2) or (store6 >= 2) or (store4 >= 1 and store6 >= 1):
		print('YES')
	else:
		print('NO')


for _ in range(1):
	n = int(input())
	arr = [0] * (10 ** 5 + 1)
	ma = [0, 0, 0, 0, 0]
	a = list(map(int, input().split()))
	cnt = [0] * (10 ** 5 + 1)
	for i in a:
		arr[i] += 1
		cnt[arr[i]] += 1
	for i in range(int(input())):
		(s, k) = map(str, input().split())
		k = int(k)
		if s == '+':
			arr[k] += 1
			cnt[arr[k]] += 1
		else:
			cnt[arr[k]] -= 1
			arr[k] -= 1
		if cnt[8] >= 1 or (cnt[6] >= 1 and cnt[2] > 1) or cnt[4] >= 2 or (cnt[4] == 1 and cnt[2] > 2):
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout
from collections import defaultdict as dd
import heapq
input = stdin.readline
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	d = dd(int)
	for i in a:
		d[i] += 1
	f = set()
	t = set()
	for i in d.keys():
		if d[i] >= 4:
			f.add(i)
		if d[i] >= 2:
			t.add(i)
	q = int(input())
	for i in range(q):
		b = list(input().split())
		if b[0] == '+':
			d[int(b[1])] += 1
		else:
			d[int(b[1])] -= 1
		if d[int(b[1])] >= 4:
			f.add(int(b[1]))
		if d[int(b[1])] >= 2:
			t.add(int(b[1]))
		if d[int(b[1])] < 4:
			if int(b[1]) in f:
				f.remove(int(b[1]))
		if d[int(b[1])] < 2:
			if int(b[1]) in t:
				t.remove(int(b[1]))
		if len(f) >= 2:
			stdout.write('YES' + '\n')
		elif len(f) == 1:
			if d[list(f)[0]] < 6 and len(t) > 2:
				stdout.write('YES' + '\n')
			elif d[list(f)[0]] in range(6, 8) and len(t) > 1:
				stdout.write('YES' + '\n')
			elif d[list(f)[0]] >= 8:
				stdout.write('YES' + '\n')
			else:
				stdout.write('NO' + '\n')
		else:
			stdout.write('NO' + '\n')


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
n = inputnum()
a = inputlist()
b = [0] * 1000000
twos = 0
fours = 0
for i in range(n):
	b[a[i]] += 1
	if b[a[i]] % 2 == 0:
		twos += 1
	if b[a[i]] % 4 == 0:
		fours += 1
q = inputnum()
for i in range(q):
	s = input()
	x = int(s[2:])
	if s[0] == '+':
		b[x] += 1
		if b[x] % 2 == 0:
			twos += 1
		if b[x] % 4 == 0:
			fours += 1
	else:
		b[x] -= 1
		if b[x] % 2 == 1:
			twos -= 1
		if b[x] % 4 == 3:
			fours -= 1
	if fours >= 1 and twos - 2 >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(i) for i in input().split()]
q = int(input())
count = [0] * 100006
for i in a:
	count[i] += 1
four = 0
two = 0
six = 0
eight = 0
for i in count:
	if i >= 4:
		four += 1
	if i >= 2:
		two += 1
	if i >= 6:
		six += 1
	if i >= 8:
		eight += 1
for _ in range(q):
	ss = input().split()
	if ss[0] == '+':
		sz = int(ss[1])
		count[sz] += 1
		if count[sz] == 2:
			two += 1
		if count[sz] == 4:
			four += 1
		if count[sz] == 6:
			six += 1
		if count[sz] == 8:
			eight += 1
	else:
		sz = int(ss[1])
		count[sz] -= 1
		if count[sz] == 1:
			two -= 1
		if count[sz] == 3:
			four -= 1
		if count[sz] == 5:
			six -= 1
		if count[sz] == 7:
			eight -= 1
	if two >= 3 and four >= 1:
		print('YES')
	elif eight >= 1:
		print('YES')
	elif two == 2 and six >= 1:
		print('YES')
	elif four == 2:
		print('YES')
	else:
		print('NO')


def check(n2, n4, n6, n8):
	if n8 >= 1:
		return True
	if n6 >= 1 and n2 >= 2:
		return True
	if n4 >= 2:
		return True
	if n4 >= 1 and n2 >= 3:
		return True
	return False
n = int(input())
a = list(map(int, input().split()))
n8 = 0
n6 = 0
n4 = 0
n2 = 0
freq = [0 for i in range(100005)]
for i in a:
	freq[i] += 1
	if freq[i] == 2:
		n2 += 1
	if freq[i] == 4:
		n4 += 1
	if freq[i] == 6:
		n6 += 1
	if freq[i] == 8:
		n8 += 1
q = int(input())
for i in range(q):
	query = input()
	x = int(query[2:])
	if query[0] == '+':
		freq[x] += 1
		if freq[x] == 2:
			n2 += 1
		if freq[x] == 4:
			n4 += 1
		if freq[x] == 6:
			n6 += 1
		if freq[x] == 8:
			n8 += 1
	else:
		if freq[x] == 2:
			n2 -= 1
		if freq[x] == 4:
			n4 -= 1
		if freq[x] == 6:
			n6 -= 1
		if freq[x] == 8:
			n8 -= 1
		freq[x] -= 1
	if check(n2, n4, n6, n8):
		print('YES')
	else:
		print('NO')


n = int(input())
a = [int(x) for x in input().split()]
hash_table = {1: 0, 2: 0, 4: 0, 6: 0, 8: 0}
freq = {}
for i in range(n):
	if a[i] not in freq:
		freq[a[i]] = 0
	freq[a[i]] += 1
for key in freq:
	border = 8
	while freq[key] < border:
		border -= 2 if border > 2 else 1
	hash_table[border] += 1
q = int(input())
for _ in range(q):
	(action, x) = [x for x in input().split()]
	x = int(x)
	if action == '+':
		if x not in freq:
			freq[x] = 0
		freq[x] += 1
		if freq[x] in hash_table:
			hash_table[freq[x]] += 1
			if freq[x] > 1:
				hash_table[freq[x] - (2 if freq[x] > 2 else 1)] -= 1
	else:
		freq[x] -= 1
		if freq[x] < 8 and (freq[x] & 1 or freq[x] == 0):
			hash_table[freq[x] + 1] -= 1
			if freq[x] != 0:
				hash_table[freq[x] - (1 if freq[x] != 1 else 0)] += 1
	if hash_table[8] >= 1 or (hash_table[6] >= 1 and (hash_table[6] >= 2 or hash_table[4] >= 1 or hash_table[2] >= 1)) or (hash_table[4] >= 1 and (hash_table[4] >= 2 or hash_table[2] >= 2)):
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
q = int(input())
d = dict()
for i in l:
	if i not in d:
		d[i] = 1
	else:
		d[i] += 1
sq = 0
rec = 0
for i in d:
	temp = d[i]
	sq += temp // 4
	temp = temp % 4
	rec += temp // 2
while q:
	q -= 1
	l = input().split()
	i = int(l[1])
	if i in d:
		temp = d[i]
		sq -= temp // 4
		temp = temp % 4
		rec -= temp // 2
	else:
		d[i] = 0
	if l[0] == '+':
		d[i] += 1
	else:
		d[i] -= 1
	if d[i] != 0:
		temp = d[i]
		sq += temp // 4
		temp = temp % 4
		rec += temp // 2
	else:
		d.pop(i)
	if sq >= 2:
		print('YES')
	elif sq == 1 and rec >= 2:
		print('YES')
	else:
		print('NO')


n = int(input())
a = list(map(int, input().split()))
ac = [0 for i in range(int(1000000.0) + 1)]
cs = 0
cr = 0
for i in a:
	ac[i] += 1
for i in ac:
	cs += i // 4
	cr += i // 2
for _ in range(int(input())):
	(x, y) = map(str, input().split())
	y = int(y)
	cs -= ac[y] // 4
	cr -= ac[y] // 2
	if x == '+':
		ac[y] += 1
	else:
		ac[y] -= 1
	cs += ac[y] // 4
	cr += ac[y] // 2
	if cs >= 1 and cr >= 4:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
d = {}
d = defaultdict(lambda : 0, d)
for i in a:
	d[i] += 1
stack4 = 0
stack2 = 0
for i in d.keys():
	stack4 += d[i] // 4
	if d[i] % 4 >= 2:
		stack2 += 1
q = int(input())
for i in range(q):
	s = input()
	s = list(s.split(' '))
	stack4 -= d[int(s[1])] // 4
	if d[int(s[1])] % 4 >= 2:
		stack2 -= 1
	if s[0] == '+':
		d[int(s[1])] += 1
	else:
		d[int(s[1])] -= 1
	stack4 += d[int(s[1])] // 4
	if d[int(s[1])] % 4 >= 2:
		stack2 += 1
	if stack4 >= 1 and stack2 >= 2 or stack4 >= 2:
		print('YES')
	else:
		print('NO')


from collections import defaultdict
n = int(input())
arr = list(map(int, input().split()))
q = int(input())
dic = defaultdict(lambda : 0)
for i in arr:
	dic[i] += 1
(to, four, six, ei) = (0, 0, 0, 0)
for i in dic:
	if dic[i] >= 8:
		ei += 1
	elif dic[i] >= 6:
		six += 1
	elif dic[i] >= 4:
		four += 1
	elif dic[i] >= 2:
		to += 1
for i in range(q):
	inp = input().split()
	s = inp[0]
	num = int(inp[1])
	if s == '-':
		if dic[num] == 8:
			ei -= 1
			six += 1
		elif dic[num] == 6:
			six -= 1
			four += 1
		elif dic[num] == 4:
			four -= 1
			to += 1
		elif dic[num] == 2:
			to -= 1
		dic[num] -= 1
	else:
		if dic[num] == 7:
			ei += 1
			six -= 1
		elif dic[num] == 5:
			six += 1
			four -= 1
		elif dic[num] == 3:
			four += 1
			to -= 1
		elif dic[num] == 1:
			to += 1
		dic[num] += 1
	if ei >= 1 or four >= 2 or six >= 2 or (six == 1 and to >= 1) or (four == 1 and to >= 2) or (six == 1 and four >= 1):
		print('YES')
	else:
		print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 1000000007

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = array()
C = Counter(a)
squares = defaultdict(int)
pairs = defaultdict(int)
for i in C:
	squares[i] = C[i] // 4
	C[i] %= 4
	pairs[i] = C[i] // 2
	C[i] %= 2
totSquare = sum(squares.values())
totPairs = sum(pairs.values())
for _ in range(Int()):
	(s, x) = input().split()
	x = int(s + x)
	if x > 0:
		x = abs(x)
		C[x] += 1
		if C[x] >= 2:
			if pairs[x] > 0:
				squares[x] += 1
				pairs[x] -= 1
				C[x] %= 2
				totPairs -= 1
				totSquare += 1
			else:
				totPairs += 1
				pairs[x] += 1
				C[x] %= 2
	else:
		x = abs(x)
		if C[x] > 0:
			C[x] -= 1
		elif pairs[x] > 0:
			pairs[x] -= 1
			totPairs -= 1
			C[x] += 1
		else:
			pairs[x] += 1
			C[x] += 1
			squares[x] -= 1
			totSquare -= 1
			totPairs += 1
	if totSquare > 0 and (totPairs > 1 or totSquare > 1):
		print('YES')
	else:
		print('NO')


def check(c, cc, ccc, cccc):
	if cc >= 2 or (ccc > 0 and c > 0) or (cc > 0 and c > 1) or (cccc >= 1) or (ccc > 0 and cc > 0) or (ccc >= 2):
		print('YES')
		return
	elif cc >= 1 and ccc >= 1:
		print('YES')
		return
	else:
		print('NO')
		return
n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = {}
for i in a:
	if i in d:
		d[i] += 1
	else:
		d[i] = 1
(c1, c2, c3, c4) = (0, 0, 0, 0)
for i in d:
	if d[i] >= 8:
		c4 += 1
	elif d[i] >= 6:
		c3 += 1
	elif d[i] >= 4:
		c2 += 1
	elif d[i] >= 2:
		c1 += 1
dd = d.copy()
for i in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		if d.get(y) != None:
			d[y] += 1
		else:
			d[y] = 1
		if d[y] == 2:
			c1 += 1
		elif d[y] == 4:
			c2 += 1
			c1 -= 1
		elif d[y] == 6:
			c3 += 1
			c2 -= 1
		elif d[y] == 8:
			c4 += 1
			c3 -= 1
	elif x == '-':
		d[y] -= 1
		if d[y] == 1:
			c1 -= 1
		elif d[y] == 3:
			c2 -= 1
			c1 += 1
		elif d[y] == 5:
			c3 -= 1
			c2 += 1
		elif d[y] == 7:
			c4 -= 1
			c3 += 1
	check(c1, c2, c3, c4)


n = int(input())
ai = list(map(int, input().split()))
q = int(input())
n2 = 10 ** 5 + 1
board = [0] * n2
for i in range(n):
	board[ai[i]] += 1
num2 = 0
num4 = 0
num6 = 0
num8 = 0
for i in board:
	if i >= 2:
		num2 += 1
		if i >= 4:
			num4 += 1
			if i >= 6:
				num6 += 1
				if i >= 8:
					num8 += 1
for i in range(q):
	action = input().split()
	action[1] = int(action[1])
	if action[0] == '+':
		board[action[1]] += 1
		if board[action[1]] == 2:
			num2 += 1
		elif board[action[1]] == 4:
			num4 += 1
		elif board[action[1]] == 6:
			num6 += 1
		elif board[action[1]] == 8:
			num8 += 1
	else:
		if board[action[1]] == 2:
			num2 -= 1
		elif board[action[1]] == 4:
			num4 -= 1
		elif board[action[1]] == 6:
			num6 -= 1
		elif board[action[1]] == 8:
			num8 -= 1
		board[action[1]] -= 1
	if num4 >= 2 or (num4 >= 1 and num2 >= 3) or (num6 >= 1 and num2 >= 2) or (num8 >= 1):
		print('YES')
	else:
		print('NO')


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def add(a):
	cnt[a] += 1
	if cnt[a] == 8:
		ss[3] += 1
		ss[2] -= 1
	if cnt[a] == 6:
		ss[2] += 1
		ss[1] -= 1
	if cnt[a] == 4:
		ss[1] += 1
		ss[0] -= 1
	if cnt[a] == 2:
		ss[0] += 1

def sub(a):
	cnt[a] -= 1
	if cnt[a] == 7:
		ss[3] -= 1
		ss[2] += 1
	if cnt[a] == 5:
		ss[2] -= 1
		ss[1] += 1
	if cnt[a] == 3:
		ss[1] -= 1
		ss[0] += 1
	if cnt[a] == 1:
		ss[0] -= 1
n = II()
aa = LI()
ss = [0] * 4
cnt = [0] * 100005
for a in aa:
	add(a)
for _ in range(II()):
	(op, a) = SI().split()
	if op == '+':
		add(int(a))
	else:
		sub(int(a))
	if ss[3] or (ss[2] and sum(ss[:3]) > 1) or (ss[1] and sum(ss[:2]) > 2) or (ss[1] > 1):
		print('YES')
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
set2 = set()
set4 = set()
allplanks = {}
for i in l:
	if i in allplanks:
		allplanks[i] += 1
	else:
		allplanks[i] = 1
for i in allplanks:
	if allplanks[i] >= 4:
		set4.add(i)
	elif allplanks[i] >= 2:
		set2.add(i)
q = int(input())
for i in range(q):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		if b in allplanks:
			allplanks[b] += 1
		else:
			allplanks[b] = 1
		if b in set2:
			set2.remove(b)
		if b in set4:
			set4.remove(b)
		if allplanks[b] >= 4:
			set4.add(b)
		elif allplanks[b] >= 2:
			set2.add(b)
	else:
		if b in allplanks:
			allplanks[b] -= 1
		if b in set2:
			set2.remove(b)
		if b in set4:
			set4.remove(b)
		if allplanks[b] >= 4:
			set4.add(b)
		elif allplanks[b] >= 2:
			set2.add(b)
	if len(set4) >= 2:
		print('YES')
	elif len(set4) == 1 and len(set2) >= 2:
		print('YES')
	elif len(set4) == 1:
		elem = set4.pop()
		set4.add(elem)
		cnt = allplanks[elem]
		if cnt >= 8:
			print('YES')
		elif cnt >= 6:
			if len(set2) >= 1:
				print('YES')
			else:
				print('NO')
		else:
			print('NO')
	else:
		print('NO')


import math
from collections import Counter
from math import factorial as fact
from collections import defaultdict
import sys

def inpint():
	return int(input())

def inpstr():
	return str(input())

def inparr():
	return list(map(int, input().strip().split()))

def inptup():
	return map(int, input().strip().split())
n = inpint()
a = inparr()
q = inpint()
d = defaultdict(lambda : 0)
sq = 0
rc = 0
lol = 0
for i in a:
	d[i] += 1
	if d[i] == 4:
		sq += 1
		rc -= 1
	elif d[i] == 2:
		rc += 1
	elif d[i] == 6:
		rc += 1
	elif d[i] == 8:
		lol += 1
		sq -= 1
		rc -= 1
for i in range(q):
	(x, y) = input().split()
	y = int(y)
	if x == '+':
		d[y] += 1
		if d[y] == 4:
			sq += 1
			rc -= 1
		elif d[y] == 2:
			rc += 1
		elif d[y] == 6:
			rc += 1
		elif d[y] == 8:
			lol += 1
			sq -= 1
			rc -= 1
		if rc >= 2 and sq >= 1:
			print('YES')
		elif sq >= 2:
			print('YES')
		elif lol >= 1:
			print('YES')
		else:
			print('NO')
	else:
		d[y] -= 1
		if d[y] == 3:
			sq -= 1
			rc += 1
		elif d[y] == 1:
			rc -= 1
		elif d[y] == 5:
			rc -= 1
		elif d[y] == 7:
			lol -= 1
			sq += 1
			rc += 1
		if rc >= 2 and sq >= 1:
			print('YES')
		elif sq >= 2:
			print('YES')
		elif lol >= 1:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
import math

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().strip().split())

def from_file(f):
	return f.readline

def solve(A, K, Z):
	res = 0
	for t in range(Z + 1):
		s = 0
		M = 0
		for i in range(1, max(K - 2 * t + 2, 0)):
			s += A[i]
			if i + 1 < len(A):
				M = max(A[i + 1] + A[i], M)
		res = max(res, s + M * t)
	return res
d = {}
d2 = {}
d4 = {}

def can_do():
	if not d4:
		return False
	if len(d4) >= 2:
		return True
	v4 = next(iter(d4.values()))
	if v4 >= 8:
		return True
	if v4 >= 6 and d2:
		return True
	if len(d2) >= 2:
		return True
	return False

def add(e):
	if e in d2:
		v = d2[e]
		if v + 1 == 4:
			d2.pop(e)
			d4[e] = 4
		else:
			d2[e] = v + 1
	elif e in d4:
		d4[e] += 1
	elif e in d:
		d.pop(e)
		d2[e] = 2
	else:
		d[e] = 1

def check():
	return 'YES' if can_do() else 'NO'

def remove(e):
	if e in d4:
		v = d4[e]
		if v - 1 == 3:
			d4.pop(e)
			d2[e] = 3
		else:
			d4[e] -= 1
	elif e in d2:
		v = d2[e]
		if v - 1 < 2:
			d2.pop(e)
			d[e] = 1
		else:
			d2[e] -= 1
	else:
		d.pop(e)
n = inp()
A = inlt()
for a in A:
	add(a)
q = inp()
for _ in range(q):
	(dir, val) = input().strip().split()
	val = int(val)
	if dir == '+':
		add(val)
	else:
		remove(val)
	print(check())


from sys import *
input = stdin.readline

def check(c2, c4, c6, c8):
	if c2 >= 2 and c4 >= 1:
		return 'YES'
	elif c4 >= 2:
		return 'YES'
	elif c6 >= 1 and (c2 >= 1 or c4 >= 1 or c6 > 1):
		return 'YES'
	elif c8 >= 1:
		return 'YES'
	return 'NO'
for _ in range(1):
	n = int(input())
	a = list(map(int, input().split()))
	d = [0] * int(100000.0 + 5)
	(cn2, cn4, cn6, cn8) = (0, 0, 0, 0)
	for i in a:
		d[i] += 1
		if d[i] == 2:
			cn2 += 1
		elif d[i] == 4:
			cn2 -= 1
			cn4 += 1
		elif d[i] == 6:
			cn4 -= 1
			cn6 += 1
		elif d[i] == 8:
			cn6 -= 1
			cn8 += 1
	q = int(input())
	for i in range(q):
		k = input()
		(sign, k) = k.split(' ')
		m = abs(int(k[:-1]))
		if sign == '-':
			d[m] -= 1
			if d[m] == 1:
				cn2 -= 1
			elif d[m] == 3:
				cn4 -= 1
				cn2 += 1
			elif d[m] == 5:
				cn6 -= 1
				cn4 += 1
			elif d[m] == 7:
				cn6 += 1
				cn8 -= 1
		else:
			d[m] += 1
			if d[m] == 2:
				cn2 += 1
			elif d[m] == 4:
				cn2 -= 1
				cn4 += 1
			elif d[m] == 6:
				cn4 -= 1
				cn6 += 1
			elif d[m] == 8:
				cn6 -= 1
				cn8 += 1
		print(check(cn2, cn4, cn6, cn8))


import sys
from collections import Counter
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
arr = list(map(int, input().split()))
freq = Counter(arr)
fours = set()
twos = set()
eights = set()

def modifySets(item):
	if freq[item] >= 8:
		eights.add(item)
	if freq[item] >= 4:
		fours.add(item)
	if freq[item] >= 2:
		twos.add(item)
for item in arr:
	modifySets(item)

def check():
	if len(eights):
		return 'YES'
	if len(fours):
		if len(fours) > 1:
			return 'YES'
		sq = fours.pop()
		fours.add(sq)
		if freq[sq] <= 5:
			if len(twos) >= 3:
				return 'YES'
		elif len(twos) >= 2:
			return 'YES'
	return 'NO'
q = int(input())
while q:
	(op, val) = map(str, input().split())
	val = int(val)
	if op == '+':
		freq[val] += 1
		modifySets(val)
	else:
		freq[val] -= 1
		if freq[val] < 2 and val in twos:
			twos.remove(val)
		if freq[val] < 4 and val in fours:
			fours.remove(val)
		if freq[val] < 8 and val in eights:
			eights.remove(val)
	print(check())
	q -= 1


from collections import Counter

def _choose_storage_index_by_count(count):
	if count < 2:
		result = 0
	elif count < 4:
		result = 1
	elif count < 6:
		result = 2
	elif count < 8:
		result = 3
	else:
		result = 4
	return result

def _choose_storage_index_by_plank(plank, storages):
	for (storage_index, storage) in enumerate(storages):
		if plank in storage.keys():
			return storage_index
	else:
		return None

def _can_build_with_storages(storages):
	can_build_square = False
	pairs_for_rectangle = 0
	for (i_storage, storage) in reversed(list(enumerate(storages))):
		min_count = i_storage * 2
		if min_count == 8 and storage:
			return True
		elif min_count == 6 and storage:
			if len(storage) == 1:
				if not can_build_square:
					can_build_square = True
					pairs_for_rectangle += 1
				else:
					return True
			else:
				return True
		elif min_count == 4 and storage:
			if len(storage) == 1:
				if not can_build_square:
					can_build_square = True
				else:
					return True
			else:
				return True
		elif min_count == 2 and storage:
			pairs_for_rectangle += len(storage)
		else:
			pass
	return can_build_square and pairs_for_rectangle >= 2

def get_answer(planks, actions):
	planks = Counter(planks)
	storages = [dict(), dict(), dict(), dict(), dict()]
	for (plank, count) in planks.items():
		storage_index = _choose_storage_index_by_count(count)
		storages[storage_index][plank] = count
	for action in actions:
		plank = abs(action)
		old_storage_index = _choose_storage_index_by_plank(plank, storages)
		if old_storage_index is not None:
			old_storage = storages[old_storage_index]
			count = old_storage[plank]
		else:
			old_storage = None
			count = 0
		if action > 0:
			count += 1
		else:
			count -= 1
		new_storage_index = _choose_storage_index_by_count(count)
		if old_storage_index != new_storage_index:
			if old_storage is not None:
				del old_storage[plank]
		new_storage = storages[new_storage_index]
		new_storage[plank] = count
		yield _can_build_with_storages(storages)

def main():
	planks_n = int(input())
	planks = tuple(map(int, input().split()))
	actions_n = int(input())
	actions = [int(input().replace(' ', '')) for i in range(actions_n)]
	statuses = get_answer(planks, actions)
	for can_build in statuses:
		if can_build:
			print('YES')
		else:
			print('NO')
main()


from sys import stdin, stdout
import heapq
import cProfile
from collections import Counter, defaultdict, deque
from functools import reduce
import math

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))

def solve():
	n = get_int()
	ls = get_list()
	freq_dic = Counter(ls)
	four_dic = defaultdict(int)
	two_dic = defaultdict(int)
	for (key, val) in freq_dic.items():
		if val >= 4:
			four_dic[key] = 1
		elif val >= 2:
			two_dic[key] = 1
	total_plank = n
	q = get_int()
	for _ in range(q):
		(oper, length) = map(str, input().strip().split())
		length = int(length)
		if oper == '+':
			freq_dic[length] += 1
			if freq_dic[length] == 4:
				four_dic[length] = 1
				if length in two_dic:
					two_dic.pop(length)
			if freq_dic[length] == 2:
				two_dic[length] = 1
			total_plank += 1
		else:
			freq_dic[length] -= 1
			if freq_dic[length] == 3:
				if length in four_dic:
					four_dic.pop(length)
				two_dic[length] = 1
			if freq_dic[length] == 1:
				if length in two_dic:
					two_dic.pop(length)
			total_plank -= 1
		if total_plank < 8:
			print('NO')
		elif len(four_dic) > 1:
			print('YES')
		elif len(four_dic) < 1:
			print('NO')
		else:
			c = 0
			for (key, val) in four_dic.items():
				if freq_dic[key] > 5:
					c += (freq_dic[key] - 4) // 2
			if c + len(two_dic) > 1:
				print('YES')
			else:
				print('NO')

def main():
	solve()
TestCases = False
if TestCases:
	for i in range(get_int()):
		main()
else:
	main()


n = int(input())
l = list(map(int, input().split()))
al = [0] * (10 ** 5 + 1)
from collections import Counter
for j in range(n):
	al[l[j]] = 1
m = Counter(l)
two = {}
four = {}
two = set()
four = set()
tw = 0
fo = 0
for j in m:
	if m[j] >= 2:
		two.add(j)
		tw += m[j] // 2
	if m[j] >= 4:
		four.add(j)
		fo += m[j] // 4
q = int(input())
for j in range(q):
	(a, b) = input().split()
	if a == '+':
		if al[int(b)] == 0:
			m[int(b)] = 1
			al[int(b)] = 1
		else:
			m[int(b)] += 1
		if m[int(b)] % 2 == 0 and m[int(b)] != 0:
			if m[int(b)] == 2:
				two.add(int(b))
			tw += 1
		if m[int(b)] % 4 == 0 and m[int(b)] != 0:
			if m[int(b)] == 4:
				four.add(int(b))
			fo += 1
	else:
		m[int(b)] -= 1
		if m[int(b)] % 2 == 1:
			if m[int(b)] == 1:
				two.remove(int(b))
			tw -= 1
		if m[int(b)] % 4 == 3:
			if m[int(b)] == 3:
				four.remove(int(b))
			fo -= 1
	if fo > 1:
		print('YES')
	elif fo == 1 and tw >= 2:
		if tw >= 4:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


from collections import defaultdict
import copy

def ii():
	return int(input())

def si():
	return input()

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())
t = ii()
l = li()
n = ii()
count = [0] * 100000
pairs = 0
squares = 0
for i in l:
	count[i - 1] += 1
	if count[i - 1] % 2 == 0:
		pairs += 1
		if count[i - 1] % 4 == 0:
			squares += 1
for j in range(n):
	inp = list(input().split())
	p = inp[0]
	i = int(inp[1])
	i -= 1
	if p == '+':
		count[i] += 1
		if count[i] % 2 == 0:
			pairs += 1
			if count[i] % 4 == 0:
				squares += 1
	else:
		if count[i] % 2 == 0:
			pairs -= 1
			if count[i] % 4 == 0:
				squares -= 1
		count[i] -= 1
	if squares > 0 and pairs > 3:
		print('YES')
	else:
		print('NO')


import io
import os
from collections import Counter

def solve(N, A, Q, queries):
	freq = Counter(A)
	freqfreq = Counter((min(v, 8) for v in freq.values()))
	ans = []
	for query in queries:
		(kind, x) = query.split()
		x = int(x)
		oldFreq = min(freq[x], 8)
		if kind == '+':
			freq[x] += 1
		else:
			assert kind == '-'
			freq[x] -= 1
		newFreq = min(freq[x], 8)
		freqfreq[oldFreq] -= 1
		freqfreq[newFreq] += 1
		numSquares = 0
		pairs = 0
		for i in range(2, 8 + 1):
			numSquares += freqfreq[i] * (i // 4)
			pairs += freqfreq[i] * (i // 2)
		if numSquares >= 2 or (numSquares and pairs - 2 >= 2):
			ans.append('YES')
		else:
			ans.append('NO')
	return '\n'.join(ans)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N,) = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
(Q,) = [int(x) for x in input().split()]
queries = [input().decode().rstrip() for i in range(Q)]
ans = solve(N, A, Q, queries)
print(ans)


mod = 10 ** 9 + 7

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	cnt8 = 0
	cnt6 = 0
	cnt4 = 0
	cnt2 = 0
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	for x in d:
		if d[x] >= 8:
			cnt8 += 1
		elif d[x] >= 6:
			cnt6 += 1
		elif d[x] >= 4:
			cnt4 += 1
		elif d[x] >= 2:
			cnt2 += 1
	q = int(input())
	while q > 0:
		(c, x) = input().split()
		x = int(x)
		val = 0
		if c == '+':
			if x in d:
				val = d[x]
				d[x] += 1
			else:
				d[x] = 1
			if val == 1:
				cnt2 += 1
			elif val == 3:
				cnt4 += 1
				cnt2 -= 1
			elif val == 5:
				cnt6 += 1
				cnt4 -= 1
			elif val == 7:
				cnt8 += 1
				cnt6 -= 1
		else:
			val = d[x]
			d[x] -= 1
			if val == 8:
				cnt8 -= 1
				cnt6 += 1
			elif val == 6:
				cnt6 -= 1
				cnt4 += 1
			elif val == 4:
				cnt4 -= 1
				cnt2 += 1
			elif val == 2:
				cnt2 -= 1
		if cnt8 > 0 or (cnt6 > 0 and (cnt2 > 0 or cnt4 > 0 or cnt6 > 1)) or cnt4 > 1 or (cnt4 > 0 and cnt2 > 1):
			print('YES')
		else:
			print('NO')
		q -= 1
t = 1
for _ in range(t):
	solve()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	a = lis()
	pairof4 = 0
	pairof2 = 0
	cnt = [0] * (10 ** 5 + 1)
	for i in range(n):
		cnt[a[i]] += 1
	for i in range(10 ** 5 + 1):
		if cnt[i] > 0:
			if cnt[i] > 3:
				pairof4 += cnt[i] // 4
			if cnt[i] % 4 > 1:
				pairof2 += 1
	q = int(inp())
	for i in range(q):
		(x, y) = strsep()
		s = [x, int(y)]
		if s[0] == '+':
			if cnt[s[1]] % 4 == 1:
				pairof2 += 1
			if cnt[s[1]] % 4 == 3:
				pairof4 += 1
				pairof2 -= 1
			cnt[s[1]] += 1
		else:
			if cnt[s[1]] % 4 == 0:
				pairof4 -= 1
				pairof2 += 1
			if cnt[s[1]] % 4 == 2:
				pairof2 -= 1
			cnt[s[1]] -= 1
		if pairof4 > 0 and (pairof2 > 1 or pairof4 > 1):
			print('YES')
		else:
			print('NO')
testcase(1)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
d = dict()
for i in range(n):
	if a[i] in d:
		d[a[i]] += 1
	else:
		d[a[i]] = 1
(d2, d4, d6, d8) = (set(), set(), set(), set())
for i in d:
	if d[i] >= 8:
		d8.add(i)
	elif d[i] >= 6:
		d6.add(i)
	elif d[i] >= 4:
		d4.add(i)
	elif d[i] >= 2:
		d2.add(i)
for i in range(q):
	(s, x) = input().split()
	x = int(x)
	if s == '+':
		if x in d:
			d[x] += 1
			if d[x] == 2:
				d2.add(x)
			elif d[x] == 4:
				d2.remove(x)
				d4.add(x)
			elif d[x] == 6:
				d4.remove(x)
				d6.add(x)
			elif d[x] == 8:
				d6.remove(x)
				d8.add(x)
		else:
			d[x] = 1
	else:
		d[x] -= 1
		if d[x] == 1:
			d2.remove(x)
		elif d[x] == 3:
			d4.remove(x)
			d2.add(x)
		elif d[x] == 5:
			d6.remove(x)
			d4.add(x)
		elif d[x] == 7:
			d8.remove(x)
			d6.add(x)
	if len(d8) > 0:
		print('YES')
	elif len(d6) >= 2:
		print('YES')
	elif len(d6) == 1 and len(d4) + len(d2) > 0:
		print('YES')
	elif len(d4) >= 2:
		print('YES')
	elif len(d4) == 1 and len(d2) >= 2:
		print('YES')
	else:
		print('NO')