Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has.

Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All wallets are also produced in form of rectangles (possibly squares).

A bill $x \times y$ fits into some wallet $h \times w$ if either $x \le h$ and $y \le w$ or $y \le h$ and $x \le w$. Bills can overlap with each other in a wallet and an infinite amount of bills can fit into a wallet. That implies that all the bills Polycarp currently have fit into a wallet if every single one of them fits into it independently of the others.

Now you are asked to perform the queries of two types:

  $+~x~y$ — Polycarp earns a bill of size $x \times y$;  $?~h~w$ — Polycarp wants to check if all the bills he has earned to this moment fit into a wallet of size $h \times w$. 

It is guaranteed that there is at least one query of type $1$ before the first query of type $2$ and that there is at least one query of type $2$ in the input data.

For each query of type $2$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise.


-----Input-----

The first line contains a single integer $n$ ($2 \le n \le 5 \cdot 10^5$) — the number of queries.

Each of the next $n$ lines contains a query of one of these two types:

  $+~x~y$ ($1 \le x, y \le 10^9$) — Polycarp earns a bill of size $x \times y$;  $?~h~w$ ($1 \le h, w \le 10^9$) — Polycarp wants to check if all the bills he has earned to this moment fit into a wallet of size $h \times w$. 

It is guaranteed that there is at least one query of type $1$ before the first query of type $2$ and that there is at least one query of type $2$ in the input data.


-----Output-----

For each query of type $2$ print "YES" if all the bills he has earned to this moment fit into a wallet of given size. Print "NO" otherwise.


-----Example-----
Input
9
+ 3 2
+ 2 3
? 1 20
? 3 3
? 2 3
+ 1 5
? 10 10
? 1 5
+ 1 1

Output
NO
YES
YES
YES
NO



-----Note-----

The queries of type $2$ of the example:

  Neither bill fits;  Both bills fit (just checking that you got that bills can overlap);  Both bills fit (both bills are actually the same);  All bills fit (too much of free space in a wallet is not a problem);  Only bill $1 \times 5$ fit (all the others don't, thus it's "NO").

Difficulty: MEDIUM

Solutions:
import sys
from atexit import register
from io import StringIO as stream

def fast_io():
	sys.stdin = stream(sys.stdin.read())
	sys.stdout = stream()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
inf = float('inf')
mod = 1000000007

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

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

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

def main():
	(h, w) = (0, 0)
	for tc in range(int(input())):
		(t, x, y) = input().split()
		x = int(x)
		y = int(y)
		if x < y:
			(x, y) = (y, x)
		if t == '+':
			h = max(h, x)
			w = max(w, y)
		elif t == '?':
			if x >= h and y >= w:
				print('YES')
			else:
				print('NO')
fast_io()
main()


n = int(input())
query = []
for i in range(n):
	query.append(input().split())
mini = 0
maxi = 0
for q in query:
	if q[0] == '+':
		maior = max(int(q[1]), int(q[2]))
		menor = min(int(q[1]), int(q[2]))
		if menor > mini:
			mini = menor
		if maior > maxi:
			maxi = maior
	else:
		maior = max(int(q[1]), int(q[2]))
		menor = min(int(q[1]), int(q[2]))
		if maior >= maxi and menor >= mini:
			print('YES')
		else:
			print('NO')


import sys
amount = int(input())
max_1 = -1
max_2 = -1
ans = ''
for i in range(amount):
	inputs = [s for s in input().split()]
	if inputs[0] == '+':
		if max_1 < min(int(inputs[1]), int(inputs[2])):
			max_1 = min(int(inputs[1]), int(inputs[2]))
		if max_2 < max(int(inputs[1]), int(inputs[2])):
			max_2 = max(int(inputs[1]), int(inputs[2]))
	elif max_1 <= int(inputs[1]) and max_2 <= int(inputs[2]) or (max_1 <= int(inputs[2]) and max_2 <= int(inputs[1])):
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


from sys import stdin, stdout
Q = int(input())
mini = 0
maxi = 0
for i in range(Q):
	arr = [x for x in stdin.readline().split()]
	arr[1] = int(arr[1])
	arr[2] = int(arr[2])
	if arr[0] == '+':
		mini = max(mini, min(arr[1], arr[2]))
		maxi = max(maxi, max(arr[1], arr[2]))
	elif arr[0] == '?':
		if min(arr[1], arr[2]) >= mini and max(arr[1], arr[2]) >= maxi:
			print('YES')
		else:
			print('NO')


import sys
n = int(sys.stdin.readline())
(mdk, msk) = (0, 0)
for i in range(n):
	s = [z for z in sys.stdin.readline().split()]
	(a, b) = (int(s[1]), int(s[2]))
	(a, b) = (max((a, b)), min((a, b)))
	if s[0] == '+':
		mdk = max(mdk, a)
		msk = max(msk, b)
	else:
		print('YES' if a >= mdk and b >= msk else 'NO')


input = __import__('sys').stdin.readline
ma1 = 0
ma2 = 0
for _ in range(int(input())):
	(a, b, c) = map(str, input().split())
	b = int(b)
	c = int(c)
	if a == '+':
		ma1 = max(ma1, b, c)
		ma2 = max(ma2, min(b, c))
	elif ma1 <= b and ma2 <= c:
		print('YES')
	elif ma1 <= c and ma2 <= b:
		print('YES')
	else:
		print('NO')


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

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

def main():
	(low, high) = (0, 0)
	t = int(input())
	for _ in range(t):
		(op, x, y) = input().strip().split()
		x = int(x)
		y = int(y)
		(x, y) = (min(x, y), max(x, y))
		if op == '+':
			low = max(low, x)
			high = max(high, y)
		elif low <= x and high <= y:
			print('YES')
		else:
			print('NO')
main()


n = int(input())
xMax = 0
yMax = 0
string = ''
for _ in range(n):
	query = input().split()
	if query[0] == '+':
		x = min(int(query[1]), int(query[2]))
		y = max(int(query[1]), int(query[2]))
		if x > xMax:
			xMax = x
		if y > yMax:
			yMax = y
	else:
		h = int(query[1])
		w = int(query[2])
		if h >= xMax and w >= yMax or (h >= yMax and w >= xMax):
			string += 'YES\n'
		else:
			string += 'NO\n'
print(string)


from sys import stdin, stdout
(x, y) = (0, 0)
ans = []
for _ in range(int(input())):
	(t, a, b) = stdin.readline().strip('\n').split()
	if t == '+':
		(a, b) = (int(a), int(b))
		if a > b:
			(a, b) = (b, a)
		x = max(x, a)
		y = max(y, b)
	else:
		(w, h) = (int(a), int(b))
		if w > h:
			(w, h) = (h, w)
		if x <= w and y <= h:
			ans.append('YES')
		else:
			ans.append('NO')
print(*ans, sep='\n')


n_queries = int(input())
min_x = -1
max_x = -1
min_y = -1
max_y = -1
ans = []
for n in range(n_queries):
	(query_type, x, y) = input().split()
	x = int(x)
	y = int(y)
	if x < y:
		temp = x
		x = y
		y = temp
	if query_type == '+':
		if max_x < x:
			max_x = x
		if max_y < y:
			max_y = y
	elif max_x <= x and max_y <= y:
		ans.append('YES')
	else:
		ans.append('NO')
for answer in range(len(ans)):
	print(ans[answer])


import io, os
input = iter(os.read(0, os.fstat(0).st_size).splitlines()).__next__
mx = my = 0
out = []
for i in range(int(input())):
	(s, x, y) = input().split()
	(x, y) = (int(x), int(y))
	if x > y:
		(x, y) = (y, x)
	if s == b'+':
		mx = max(mx, x)
		my = max(my, y)
	else:
		out.append('YES' if x >= mx and y >= my else 'NO')
print('\n'.join(out))


n = int(input())
ma = 0
mb = 0
s = ''
for i in range(n):
	a = input().split()
	a[1] = int(a[1])
	a[2] = int(a[2])
	if a[2] < a[1]:
		(a[1], a[2]) = (a[2], a[1])
	if a[0] == '+':
		ma = max(ma, a[1])
		mb = max(mb, a[2])
	elif a[1] >= ma and a[2] >= mb:
		s += 'YES\n'
	else:
		s += 'NO\n'
print(s)


N = int(input())
(H, W) = (0, 0)
Ans = []
for i in range(N):
	(op, x, y) = input().split()
	(x, y) = (min(int(x), int(y)), max(int(x), int(y)))
	if op == '+':
		H = max(x, H)
		W = max(y, W)
	elif H <= x and W <= y:
		Ans += ['YES']
	else:
		Ans += ['NO']
print('\n'.join(Ans))


import sys
inf = float('inf')
mod = 1000000007

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

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

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

def main():
	(h, w) = (0, 0)
	for tc in range(int(input())):
		(t, x, y) = input().split()
		x = int(x)
		y = int(y)
		if x < y:
			(x, y) = (y, x)
		if t == '+':
			h = max(h, x)
			w = max(w, y)
		elif t == '?':
			if x >= h and y >= w:
				print('YES')
			else:
				print('NO')
main()


import itertools
import bisect
import math
from collections import *
import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

def main():
	w = 0
	h = 0
	for _ in ' ' * int(input()):
		s = list(input().split(' '))
		a = int(s[1])
		b = int(s[2])
		aa = min(a, b)
		bb = max(a, b)
		if s[0] == '+':
			w = max(w, aa)
			h = max(h, bb)
		elif w <= aa and h <= bb:
			print('YES')
		else:
			print('NO')
	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')
main()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def main():
	query_num = int(input())
	(max_x, max_y) = (0, 0)
	for _ in range(query_num):
		(sym, ca, cb) = input().split()
		if sym == '+':
			(x, y) = (int(ca), int(cb))
			if x > y:
				(x, y) = (y, x)
			max_x = max(x, max_x)
			max_y = max(y, max_y)
		elif sym == '?':
			(h, w) = (int(ca), int(cb))
			if h > w:
				(h, w) = (w, h)
			if h >= max_x and w >= max_y:
				print('YES')
			else:
				print('NO')
main()


import sys
q = int(input())
mi = 0
ma = 0
for j in range(q):
	(a, b, c) = map(str, sys.stdin.readline().split())
	r = int(b)
	s = int(c)
	if a == '+':
		mi = max(mi, min(r, s))
		ma = max(ma, max(r, s))
	else:
		p = min(r, s)
		q = max(r, s)
		if mi <= p and ma <= q:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
n = int(input())
a = [list(map(str, input().split())) for _ in range(n)]
tate = 0
yoko = 0
for i in range(n):
	if a[i][0] == '+':
		b = [int(a[i][1]), int(a[i][2])]
		b.sort()
		if tate < b[0]:
			tate = b[0]
		if yoko < b[1]:
			yoko = b[1]
	elif a[i][0] == '?':
		b = [int(a[i][1]), int(a[i][2])]
		b.sort()
		if tate <= b[0] and yoko <= b[1]:
			print('YES')
		else:
			print('NO')


import sys
a = 0
b = 0
for _ in range(int(input())):
	(d, n, m) = sys.stdin.readline().split()
	n = int(n)
	m = int(m)
	if d == '+':
		a = max(min(m, n), a)
		b = max(max(m, n), b)
	elif a <= n and b <= m or (b <= n and a <= m):
		print('YES')
	else:
		print('NO')


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def main():
	n = int(input())
	(mx, my) = (0, 0)
	ans = []
	for (qtype, x, y) in (input().split() for _ in range(n)):
		(x, y) = (int(x), int(y))
		if x > y:
			(x, y) = (y, x)
		if qtype == '+':
			(mx, my) = (max(mx, x), max(my, y))
		else:
			ans.append('YES' if mx <= x and my <= y else 'NO')
	sys.stdout.buffer.write(('\n'.join(ans) + '\n').encode('utf-8'))
main()


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
n = int(input())
m = [0, 0]
ans = []
for i in range(n):
	inp = input().split()
	if inp[0] == '+':
		wal = sorted([int(inp[1]), int(inp[2])])
		if wal[0] > m[0]:
			m[0] = wal[0]
		if wal[1] > m[1]:
			m[1] = wal[1]
		m.sort()
	else:
		kos = sorted([int(inp[1]), int(inp[2])])
		if kos[0] >= m[0] and kos[1] >= m[1]:
			ans.append(True)
		else:
			ans.append(False)
for a in ans:
	print('YES') if a else print('NO')


import sys
n = int(input())
w = 0
h = 0
cmds = sys.stdin.read().splitlines()
for cmd in cmds:
	cmd = cmd.split()
	new_w = int(cmd[1])
	new_h = int(cmd[2])
	if new_w < new_h:
		(new_w, new_h) = (new_h, new_w)
	if cmd[0] == '+':
		w = max(w, new_w)
		h = max(h, new_h)
	else:
		print('YES' if new_w >= w and new_h >= h else 'NO')


import sys
lax = -10 ** 9
lay = -10 ** 9
for _ in range(int(input())):
	(sign, x, y) = map(str, sys.stdin.readline().split())
	x = int(x)
	y = int(y)
	if sign == '+':
		if y > x:
			t = x
			x = y
			y = t
		lax = max(x, lax)
		lay = max(y, lay)
	else:
		if y > x:
			t = x
			x = y
			y = t
		if lax <= x and lay <= y:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	n = int(stdin.readline())
	maxx = 0
	maxy = 0
	for _ in range(n):
		query = stdin.readline().split()
		if query[0] == '+':
			x = int(query[1])
			y = int(query[2])
			if x > y:
				(x, y) = (y, x)
			maxx = max(maxx, x)
			maxy = max(maxy, y)
		else:
			h = int(query[1])
			w = int(query[2])
			if h > w:
				(h, w) = (w, h)
			res = 'NO'
			if maxx <= h and maxy <= w:
				res = 'YES'
			stdout.write(res + '\n')
	return 0
main()


n = int(input())
mini = -1
maxi = -1
ans_arr = []
for t in range(n):
	[a, b, c] = input().split()
	b = int(b)
	c = int(c)
	if a == '+':
		v1 = min(b, c)
		v2 = max(b, c)
		if v1 > mini:
			mini = v1
		if v2 > maxi:
			maxi = v2
	elif mini <= b and maxi <= c or (mini <= c and maxi <= b):
		ans_arr.append('YES')
	else:
		ans_arr.append('NO')
for k in range(len(ans_arr)):
	print(ans_arr[k])


n = int(input())
mx = 0
my = 0
s = ''
for i in range(n):
	a = input().split()
	a[1] = int(a[1])
	a[2] = int(a[2])
	if a[2] < a[1]:
		(a[1], a[2]) = (a[2], a[1])
	if a[0] == '+':
		mx = max(mx, a[1])
		my = max(my, a[2])
	elif a[1] >= mx and a[2] >= my:
		s += 'YES' + '\n'
	else:
		s += 'NO' + '\n'
print(s)


import os
import sys
from io import BytesIO, IOBase

def main():
	maxx = 0
	maxy = 0
	r = ''
	for __ in range(int(input())):
		s = input().split()
		(x, y) = (min([int(s[1]), int(s[2])]), max(int(s[1]), int(s[2])))
		if s[0] == '+':
			maxx = max(maxx, x)
			maxy = max(maxy, y)
		else:
			(h, w) = (x, y)
			if h < maxx or w < maxy:
				print('NO')
			else:
				print('YES')
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 I():
	return list(map(int, input().split()))
main()


T = int(input())
x = 0
y = 0
uu = []
for _ in range(T):
	(p, a, b) = input().split()
	a = int(a)
	b = int(b)
	if p == '+':
		x = max(x, max(a, b))
		y = max(y, min(a, b))
	elif max(a, b) >= x and min(a, b) >= y:
		uu.append('YES')
	else:
		uu.append('NO')
print('\n'.join(uu))


import sys
input = sys.stdin.readline
N = int(input())
a = -1
b = -1
for i in range(N):
	(t, x, y) = input().split()
	(x, y) = (int(x), int(y))
	if t == '+':
		a = max(a, min(x, y))
		b = max(b, max(x, y))
	else:
		h = min(x, y)
		w = max(x, y)
		if a <= h and b <= w:
			print('YES')
		else:
			print('NO')


n = int(input())
c = [0, 0]
ans = []
for i in range(n):
	(minx, miny) = (c[0], c[1])
	(v, x, y) = input().split()
	(x, y) = (int(x), int(y))
	(x, y) = (max(x, y), min(x, y))
	if v == '+':
		if not (x <= minx and y <= miny or (x <= miny and y <= minx)):
			if x > minx:
				if y > minx:
					minx = y
					if x > miny:
						miny = x
				else:
					minx = x
					if y > miny:
						miny = y
			elif y > miny:
				miny = y
	elif x >= minx and y >= miny or (x >= miny and y >= minx):
		ans.append('YES')
	else:
		ans.append('NO')
	c = sorted([minx, miny], reverse=True)
print('\n'.join(ans))


import sys
from collections import defaultdict as dd
input = sys.stdin.readline
n = int(input())
x = 0
y = 0
h = 0
w = 0
m1 = 0
m2 = 0
for i in range(n):
	l = list(map(str, input().split()))
	x = int(l[1])
	y = int(l[2])
	if x > y:
		(x, y) = (y, x)
	if l[0] == '+':
		m1 = max(x, m1)
		m2 = max(y, m2)
	elif x >= m1 and y >= m2:
		print('YES')
	else:
		print('NO')


n = int(input())
queries = list()
maxX = 0
maxY = 0
for i in range(n):
	aux = input().split(' ')
	aux[1] = int(aux[1])
	aux[2] = int(aux[2])
	queries.append(aux)
for query in queries:
	if query[1] > query[2]:
		aux = query[1]
		query[1] = query[2]
		query[2] = aux
	if query[0] == '+':
		maxX = max(maxX, query[1])
		maxY = max(maxY, query[2])
	elif query[1] >= maxX and query[2] >= maxY:
		print('YES')
	elif query[2] >= maxX and query[1] >= maxY:
		print('YES')
	else:
		print('NO')


n = int(input())
m = [0, 0]
ans = []
for i in range(n):
	inp = input().split()
	if inp[0] == '+':
		wal = sorted([int(inp[1]), int(inp[2])])
		if wal[0] > m[0]:
			m[0] = wal[0]
		if wal[1] > m[1]:
			m[1] = wal[1]
		m.sort()
	else:
		kos = sorted([int(inp[1]), int(inp[2])])
		if kos[0] >= m[0] and kos[1] >= m[1]:
			ans.append(True)
		else:
			ans.append(False)
for a in ans:
	print('YES') if a else print('NO')


import sys
input = sys.stdin.readline
n = int(input())
mi = -1
ma = -1
for i in range(n):
	a = input().split()
	b = int(a[1])
	c = int(a[2])
	if b > c:
		(b, c) = (c, b)
	if a[0] == '+':
		mi = max(b, mi)
		ma = max(c, ma)
	elif a[0] == '?':
		if mi <= b and ma <= c:
			print('YES')
		else:
			print('NO')


import sys
m1 = 0
m2 = 0
for _ in range(int(input())):
	(d, h, w) = sys.stdin.readline().split()
	(h, w) = (int(h), int(w))
	if d == '+':
		m1 = max(min(h, w), m1)
		m2 = max(max(h, w), m2)
	else:
		print('YES') if h >= m1 and w >= m2 or (h >= m2 and w >= m1) else print('NO')


import sys
input = sys.stdin.readline
(mx, mi) = (0, 0)
for _ in range(int(input())):
	(k, l, b) = input().split()
	l = int(l)
	b = int(b)
	if k == '+':
		mx = max(mx, max(l, b))
		mi = max(mi, min(l, b))
	elif k == '?':
		if l >= b:
			if l >= mx and b >= mi:
				print('YES')
			else:
				print('NO')
		elif b >= mx and l >= mi:
			print('YES')
		else:
			print('NO')


from sys import stdin, stdout

def test(ma, mb, a, b):
	return ma <= a and mb <= b
n = int(input())
xs = []
(ma, mb) = (0, 0)
res = []
d = {True: 'YES\n', False: 'NO\n'}
for _ in range(n):
	(t, a, b) = stdin.readline().strip().split()
	(a, b) = (int(a), int(b))
	(a, b) = (max(a, b), min(a, b))
	if t == '+':
		(ma, mb) = (max(a, ma), max(b, mb))
	else:
		res.append(d[test(ma, mb, a, b)])
stdout.writelines(res)


n = int(input())
(x, y) = (0, 0)
ans = []
for i in range(n):
	s = input()
	a = s[0]
	(b, c) = map(int, s[2:].split())
	if a == '+':
		if b > c:
			(b, c) = (c, b)
		(x, y) = (max(x, b), max(y, c))
	else:
		if b > c:
			(b, c) = (c, b)
		if x <= b and y <= c:
			ans.append('YES')
		else:
			ans.append('NO')
print('\n'.join(ans))


lMax = 0
rMax = 0
N = int(input())
ans = ''
for i in range(N):
	A = input().split()
	Z = A[0]
	l = int(A[1])
	r = int(A[2])
	if r > l:
		(l, r) = (r, l)
	if Z == '+':
		if l > lMax:
			lMax = l
		if r > rMax:
			rMax = r
	elif rMax <= r and lMax <= l:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
minmax = -1
maxmax = -1
first = []
second = []
for i in range(n):
	(typ, a, b) = input().split()
	a = int(a)
	b = int(b)
	if typ == '+':
		if max(a, b) > maxmax:
			maxmax = max(a, b)
			first = [min(a, b), max(a, b)]
		if max(a, b) == maxmax:
			if min(a, b) > first[0]:
				first = [min(a, b), max(a, b)]
		if min(a, b) > minmax:
			minmax = min(a, b)
			second = [min(a, b), max(a, b)]
		if min(a, b) == minmax:
			if min(a, b) > second[0]:
				second = [min(a, b), max(a, b)]
	elif (first[0] <= min(a, b) and first[1] <= max(a, b)) and (second[0] <= min(a, b) and second[1] <= max(a, b)):
		print('YES')
	else:
		print('NO')


from sys import stdin
n = int(stdin.readline().strip())
mx = 0
my = 0
for _ in range(n):
	(symbol, x, y) = list(stdin.readline().split())
	x = int(x)
	y = int(y)
	if x > y:
		(x, y) = (y, x)
	if symbol == '+':
		mx = max(mx, x)
		my = max(my, y)
	elif mx <= x and my <= y:
		print('YES')
	else:
		print('NO')


from sys import stdin
n = int(input())
Min = 0
Max = 0
for _ in range(n):
	(a, b, c) = stdin.readline().split()
	b = int(b)
	c = int(c)
	if a == '+':
		Min = max(Min, min(b, c))
		Max = max(Max, max(b, c))
	elif Min <= min(b, c) and Max <= max(b, c):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
mmax = 0
mmin = 0
ans = []
for i in range(n):
	s = input().split()
	(a, b) = (int(s[1]), int(s[2]))
	if a > b:
		mx = a
		mn = b
	else:
		mn = a
		mx = b
	if s[0] == '+':
		if mx > mmax:
			mmax = mx
		if mn > mmin:
			mmin = mn
	elif mx >= mmax and mn >= mmin:
		ans.append('YES')
	else:
		ans.append('NO')
print('\n'.join(ans))


import sys

class Bill:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def getX(self):
		return self.x

	def getY(self):
		return self.y

def main():
	n = int(sys.stdin.readline())
	x_largest = 0
	y_largest = 0
	for _ in range(n):
		(q, x, y) = sys.stdin.readline().split()
		x = int(x)
		y = int(y)
		if y > x:
			(x, y) = (y, x)
		if q == '+':
			if x > x_largest:
				x_largest = x
			if y > y_largest:
				y_largest = y
		else:
			c1 = x >= x_largest and y >= y_largest or (x >= y_largest and y >= x_largest)
			if c1:
				print('YES')
			else:
				print('NO')
main()


from sys import stdin, stdout
n = int(stdin.readline())
mama = -1
mami = -1
for _ in range(n):
	(s, x, y) = map(str, stdin.readline().split())
	x = int(x)
	y = int(y)
	if s == '+':
		ma = max(x, y)
		mi = min(x, y)
		if ma > mama:
			mama = ma
		if mi > mami:
			mami = mi
	else:
		h = max(x, y)
		b = min(x, y)
		if h >= mama and b >= mami:
			stdout.write('YES')
			stdout.write('\n')
		else:
			stdout.write('NO')
			stdout.write('\n')


a = b = 0
s = ''
for f in range(int(input())):
	i = input().split()
	x = min(int(i[1]), int(i[2]))
	y = max(int(i[1]), int(i[2]))
	if i[0] == '?':
		if x < a or y < b:
			s += 'NO\n'
		else:
			s += 'YES\n'
	else:
		(a, b) = (max(a, x), max(b, y))
print(s[:-1])


q = int(input())
(o, x, y) = input().split()
x = int(x)
y = int(y)
arz = min(x, y)
tool = max(x, y)
ans = ''
for i in range(1, q):
	(o, x, y) = input().split()
	x = int(x)
	y = int(y)
	if x > y:
		(x, y) = (y, x)
	if o == '+':
		if x > arz:
			arz = x
		if y > tool:
			tool = y
	elif x < arz or y < tool:
		ans += 'NO\n'
	else:
		ans += 'YES\n'
print(ans)


import sys
input = sys.stdin.readline
n = int(input())
(tmp, x, y) = input().split()
x = int(x)
y = int(y)
mxB = [max(x, y), min(x, y)]
for i in range(n - 1):
	(tmp, x, y) = input().split()
	x = int(x)
	y = int(y)
	mxx = max(x, y)
	mnn = min(x, y)
	if tmp == '+':
		if mxx > mxB[0]:
			mxB[0] = mxx
		if mnn > mxB[1]:
			mxB[1] = mnn
	else:
		print('YES' if mxx >= mxB[0] and mnn >= mxB[1] else 'NO')


import io, os
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
mx = my = 0
out = []
for i in range(int(input())):
	(s, x, y) = input().split()
	(x, y) = (int(x), int(y))
	if x > y:
		(x, y) = (y, x)
	if s == '+':
		mx = max(mx, x)
		my = max(my, y)
	else:
		out.append('YES' if x >= mx and y >= my else 'NO')
os.write(1, '\n'.join(out).encode())


n = int(input())
w_max = 0
h_max = 0
ans = []
for i in range(n):
	q = input().split()
	q[1] = int(q[1])
	q[2] = int(q[2])
	if q[0] == '+':
		w = max(q[1], q[2])
		h = min(q[1], q[2])
		w_max = max(w, w_max)
		h_max = max(h, h_max)
		if w_max < h_max:
			(w_max, h_max) = (h_max, w_max)
	else:
		w = max(q[1], q[2])
		h = min(q[1], q[2])
		if w_max > w or h_max > h:
			ans.append('NO')
		else:
			ans.append('YES')
for i in ans:
	print(i)


input = __import__('sys').stdin.readline
x = 0
y = 0
for _ in range(int(input())):
	(a, b, c) = map(str, input().split())
	(b, c) = (int(b), int(c))
	if a == '+':
		x = max(x, min(b, c))
		y = max(y, max(b, c))
	elif b >= x and c >= y or (c >= x and b >= y):
		print('YES')
	else:
		print('NO')


import io, os
input = io.StringIO(os.read(0, os.fstat(0).st_size).decode()).readline
(maxw, maxh) = (0, 0)
for _ in range(int(input())):
	x = input().split()
	(w, h) = map(int, x[1:])
	if h > w:
		(w, h) = (h, w)
	if x[0] == '+':
		if w > maxw:
			maxw = w
		if h > maxh:
			maxh = h
	else:
		print('YES' if maxw <= w and maxh <= h else 'NO')


import sys
import math
from heapq import *
input = sys.stdin.readline
from functools import cmp_to_key

def pi():
	return int(input())

def pl():
	return int(input(), 16)

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

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

def invr():
	return map(int, input().split())
mod = 1000000007
f = []

def fact(n, m):
	global f
	f = [1 for i in range(n + 1)]
	f[0] = 1
	for i in range(1, n + 1):
		f[i] = f[i - 1] * i % m

def fast_mod_exp(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b = b >> 1
	return res

def inverseMod(n, m):
	return fast_mod_exp(n, m - 2, m)

def ncr(n, r, m):
	if n < 0 or r < 0 or r > n:
		return 0
	if r == 0:
		return 1
	return f[n] * inverseMod(f[n - r], m) % m * inverseMod(f[r], m) % m

def main():
	polyNewJob()

def cmp(a, b):
	if a[1] > b[1]:
		return 1
	if a[1] < b[1]:
		return -1
	return 0

def C():
	n = pi()
	(k, c) = ([], [])
	for i in range(n):
		[x, y] = ti()
		k.append(x)
		c.append(y)
	(t, p) = (pi(), ti())
	kc = [[] for i in range(n)]
	for i in range(n):
		kc[i] = [k[i], c[i]]
	kc.sort(key=cmp_to_key(cmp))
	(i, j) = (0, 0)
	d = p[0]
	ans = 0
	while j < n:
		if kc[j][0] < d:
			ans += kc[j][0] * (i + 1) * kc[j][1]
			d -= kc[j][0]
			j += 1
		else:
			ans += d * (i + 1) * kc[j][1]
			kc[j][0] -= d
			i += 1
			if i < t:
				d = p[i] - p[i - 1]
	print(ans)

def polyNewJob():
	n = pi()
	mxH = 0
	mxW = 0
	for i in range(n):
		[a, b, c] = input().split(' ')
		c = c[:-1]
		if a == '+':
			[x, y] = [max(int(b), int(c)), min(int(b), int(c))]
			mxH = max(mxH, x)
			mxW = max(mxW, y)
		elif mxH <= max(int(b), int(c)) and mxW <= min(int(b), int(c)):
			print('YES')
		else:
			print('NO')
main()


import sys
input = sys.stdin.readline
max_small = 0
max_large = 0
for i in range(int(input())):
	tokens = input().split()
	if tokens[0] == '+':
		x = int(tokens[1])
		y = int(tokens[2])
		max_small = max(max_small, min(x, y))
		max_large = max(max_large, x, y)
	elif tokens[0] == '?':
		h = int(tokens[1])
		w = int(tokens[2])
		fits = max_small <= h and max_large <= w or (max_large <= h and max_small <= w)
		print('YES' if fits else 'NO')


import sys
input = sys.stdin.readline
mx = my = 0
out = []
for i in range(int(input())):
	(s, x, y) = input().split()
	(x, y) = (int(x), int(y))
	if x > y:
		(x, y) = (y, x)
	if s == '+':
		mx = max(mx, x)
		my = max(my, y)
	else:
		out.append('YES' if x >= mx and y >= my else 'NO')
print('\n'.join(out))


def main():
	ans = []
	n = int(input())
	max_x = 0
	max_y = 0
	for i in range(n):
		query = list(map(str, input().split()))
		if query[0] == '+':
			(x, y) = (int(query[1]), int(query[2]))
			(x, y) = (min(x, y), max(x, y))
			max_x = max(max_x, x)
			max_y = max(max_y, y)
		else:
			(h, w) = (int(query[1]), int(query[2]))
			(h, w) = (min(h, w), max(h, w))
			if max_x <= h and max_y <= w:
				ans.append('YES')
			else:
				ans.append('NO')
	for i in ans:
		print(i)
main()


import sys
import math
from collections import *
from queue import *
from bisect import *
MOD = int(1000000000.0 + 7)
inf = float('inf')
ninf = float('-inf')
input = sys.stdin.readline

def ii():
	return list(map(int, input().strip().split()))
(l, r) = (0, 0)
for _ in range(int(input())):
	s = input().strip().split()
	a = min(int(s[1]), int(s[2]))
	b = max(int(s[1]), int(s[2]))
	if s[0] == '+':
		l = max(l, a)
		r = max(r, b)
	elif a >= l and b >= r:
		print('YES')
	else:
		print('NO')


min_x = 0
min_y = 0
ans = ''
for i in range(int(input())):
	(q, _x, _y) = input().split()
	_x = int(_x)
	_y = int(_y)
	x = min(_x, _y)
	y = max(_x, _y)
	if q == '+':
		min_x = max(x, min_x)
		min_y = max(y, min_y)
	elif x >= min_x and y >= min_y:
		ans += 'YES\n'
	else:
		ans += 'NO\n'
print(ans, end='')


import sys
n = int(input())
mx = 0
my = 0
for i in range(n):
	(s, x, y) = sys.stdin.readline().split()
	x = int(x)
	y = int(y)
	if s == '+':
		mx = max(mx, min(x, y))
		my = max(my, max(x, y))
	elif mx <= x and my <= y or (my <= x and mx <= y):
		print('YES')
	else:
		print('NO')


(mi, ma) = (0, 0)
n = int(input())
re = []
for _ in range(n):
	(c, x, y) = input().split()
	(x, y) = (min(int(x), int(y)), max(int(x), int(y)))
	if c == '+':
		mi = max(mi, x)
		ma = max(ma, y)
	elif mi <= x and ma <= y:
		re.append('YES')
	else:
		re.append('NO')
print('\n'.join((i for i in re)))


import heapq
from sys import stdin, stdout
n = int(stdin.readline())
size = []
for i in range(n):
	(a, f, s) = stdin.readline().split()
	curVlaue = [int(f), int(s)]
	curVlaue.sort()
	if a == '+':
		if len(size) > 0:
			compare1 = heapq.heappop(size)
			compare2 = heapq.heappop(size)
			heapq.heappush(size, max(curVlaue[0], compare1))
			heapq.heappush(size, max(curVlaue[1], compare2))
		else:
			heapq.heappush(size, curVlaue[0])
			heapq.heappush(size, curVlaue[1])
	elif curVlaue[0] >= size[0] and curVlaue[1] >= size[1] or (curVlaue[1] >= size[0] and curVlaue[0] >= size[1]):
		stdout.write('YES\n')
	else:
		stdout.write('NO\n')


import sys
import io
n = int(input())
w = 0
h = 0
cmds = sys.stdin.read().splitlines()
old_stdout = sys.stdout
buf = io.StringIO()
sys.stdout = buf
for cmd in cmds:
	cmd = cmd.split()
	new_w = int(cmd[1])
	new_h = int(cmd[2])
	if new_w < new_h:
		(new_w, new_h) = (new_h, new_w)
	if cmd[0] == '+':
		w = max(w, new_w)
		h = max(h, new_h)
	else:
		print('YES' if new_w >= w and new_h >= h else 'NO')
sys.stdout = old_stdout
print(buf.getvalue(), end='')


from sys import *
(top, bot) = (-1, -1)
for c in range(int(input())):
	q = stdin.readline().split()
	(m1, m2) = (int(q[1]), int(q[2]))
	if m1 > m2:
		(m1, m2) = (m2, m1)
	if q[0] == '+':
		if top < m1:
			top = m1
		if bot < m2:
			bot = m2
	elif m1 < top or m2 < bot:
		print('NO')
	else:
		print('YES')


from sys import stdin
input = stdin.readline
x = 0
y = 0
for _ in range(int(input())):
	(s, a, b) = input().split()
	a = int(a)
	b = int(b)
	if s == '+':
		x = max(x, min(a, b))
		y = max(y, max(a, b))
	elif x <= min(a, b) and y <= max(a, b):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
y = z = -float('inf')
for i in range(n):
	(x, yy, zz) = map(str, input().split())
	if x == '+':
		a = [int(yy), int(zz)]
		a.sort()
		yy = a[0]
		zz = a[1]
		y = max(y, int(yy))
		z = max(z, int(zz))
	elif y <= int(yy) and z <= int(zz) or (y <= int(zz) and z <= int(yy)):
		print('YES')
	else:
		print('NO')


import sys
input = sys.stdin.readline
n = int(input())
blx = 0
bly = 0
for _ in range(n):
	(ipt, a, b) = input().split()
	if ipt == '+':
		(x, y) = (int(a), int(b))
		if x > y:
			(x, y) = (y, x)
		blx = max(blx, x)
		bly = max(bly, y)
	else:
		(h, w) = (int(a), int(b))
		if h > w:
			(h, w) = (w, h)
		if h >= blx and w >= bly:
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
x = y = -1
for _ in range(int(input())):
	(a, b, c) = input().strip().split()
	(b, c) = (int(b), int(c))
	if a == '+':
		if x == -1:
			(x, y) = (b, c)
		elif not (b <= x and c <= y or (c <= x and b <= y)):
			(p, q, r, s) = (max(x, b), max(y, c), max(c, x), max(b, y))
			if p * q < r * s:
				(x, y) = (p, q)
			else:
				(x, y) = (r, s)
	else:
		(h, w) = (int(b), int(c))
		f = 1
		if x <= h and y <= w or (y <= h and x <= w):
			f = 0
		print('YNEOS'[f::2])


import sys
input = sys.stdin.readline
Q = int(input())
nx = 0
ny = 0
for i in range(Q):
	(q, x, y) = input().split()
	(x, y) = (int(x), int(y))
	if x > y:
		(x, y) = (y, x)
	if q == '+':
		nx = max(nx, x)
		ny = max(ny, y)
	elif x >= nx and y >= ny:
		print('YES')
	else:
		print('NO')


import sys
n = int(input())
x = 0
y = 0
for i in range(n):
	task = sys.stdin.readline().split()
	(task[1], task[2]) = list(map(int, task[1:]))
	if task[0] == '+':
		x = max(x, max(task[1:]))
		y = max(y, min(task[1:]))
	elif max(task[1:]) >= x and min(task[1:]) >= y:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
t = int(stdin.readline())
cmin = 0
cmax = 0
no = 'NO\n'
yes = 'YES\n'
for i in range(t):
	(q, x, y) = stdin.readline().split()
	x = int(x)
	y = int(y)
	if q == '+':
		k = min(x, y)
		if k > cmin:
			cmin = k
		k = max(x, y)
		if k > cmax:
			cmax = k
	else:
		l = min(x, y)
		if l < cmin:
			stdout.write(no)
			continue
		else:
			l = max(x, y)
			if l < cmax:
				stdout.write(no)
				continue
			else:
				stdout.write(yes)


from sys import stdin, stdout
input = stdin.readline
n = int(input())
(a, b) = (0, 0)
(mn, mx) = (0, 0)
for i in range(n):
	s = input().strip().split()
	if s[0] == '+':
		(x, y) = map(int, s[1:])
		(a, b) = (max(a, b), min(a, b))
		a = max(a, min(x, y))
		b = max(b, max(x, y))
		mx = max(mx, max(x, y))
		mn = max(mn, min(x, y))
	else:
		(h, w) = map(int, s[1:])
		(h, w) = (max(h, w), min(h, w))
		(a, b) = (max(a, b), min(a, b))
		print('YES' if h >= a and w >= b or (h >= mx and w >= mn) else 'NO')


n = int(input())
(size1, size2) = (0, 0)
from sys import stdin
for i in range(n):
	q = stdin.readline().split()
	(t, a, b) = (str(q[0]), int(q[1]), int(q[2]))
	(mx, mn) = (max(a, b), min(a, b))
	if t == '+':
		if mx > size1:
			size1 = mx
		if mn > size2:
			size2 = mn
	elif size1 > mx or size2 > mn:
		print('NO')
	else:
		print('YES')


from itertools import combinations
from sys import stdin
import math

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

def stringIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())
n = intIn()
count = 0
for i in range(n):
	q = stringIn()
	if q[0] == '+':
		(x, y) = (int(q[1]), int(q[2]))
		count += 1
		if count == 1:
			m1 = max(x, y)
			m2 = min(x, y)
		else:
			m1 = max(m1, max(x, y))
			m2 = max(m2, min(x, y))
	else:
		(h, w) = (int(q[1]), int(q[2]))
		if m2 <= min(h, w) and m1 <= max(h, w):
			print('YES')
		else:
			print('NO')


import sys
input = sys.stdin.readline
n = int(input())
x = 0
y = 0
for k in range(n):
	(a, m, n) = input().split()
	m = int(m)
	n = int(n)
	p = max(m, n)
	q = min(m, n)
	if a == '+':
		x = max(x, p)
		y = max(y, q)
	elif a == '?':
		if x <= p and y <= q:
			print('YES')
		else:
			print('NO')


import sys
n = int(sys.stdin.readline().strip())
m = 0
M = 0
for i in range(0, n):
	line = sys.stdin.readline().strip().split()
	s = line[0]
	x = min([int(line[1]), int(line[2])])
	y = max([int(line[1]), int(line[2])])
	if s == '+':
		m = max([m, x])
		M = max([M, y])
	elif x >= m and y >= M:
		print('YES')
	else:
		print('NO')


(left_max, right_max) = (0, 0)
res = []
for _ in range(int(input())):
	(op, left, right) = input().split()
	(left, right) = (int(left), int(right))
	if left < right:
		(left, right) = (right, left)
	if op == '+':
		(left_max, right_max) = (max(left_max, left), max(right_max, right))
	elif left_max <= left and right_max <= right:
		res.append('YES')
	else:
		res.append('NO')
for answer in res:
	print(answer)


(x, y) = (0, 0)
from sys import stdin
for _ in range(int(input())):
	(a, i, j) = (o for o in stdin.readline().split())
	(i, j) = (int(i), int(j))
	if a == '+':
		x = max(x, min(i, j))
		y = max(y, max(i, j))
	elif x <= i and y <= j or (x <= j and y <= i):
		print('YES')
	else:
		print('NO')