Tenten runs a weapon shop for ninjas. Today she is willing to sell $n$ shurikens which cost $1$, $2$, ..., $n$ ryo (local currency). During a day, Tenten will place the shurikens onto the showcase, which is empty at the beginning of the day. Her job is fairly simple: sometimes Tenten places another shuriken (from the available shurikens) on the showcase, and sometimes a ninja comes in and buys a shuriken from the showcase. Since ninjas are thrifty, they always buy the cheapest shuriken from the showcase.

Tenten keeps a record for all events, and she ends up with a list of the following types of records:

  + means that she placed another shuriken on the showcase;  - x means that the shuriken of price $x$ was bought. 

Today was a lucky day, and all shurikens were bought. Now Tenten wonders if her list is consistent, and what could be a possible order of placing the shurikens on the showcase. Help her to find this out!


-----Input-----

The first line contains the only integer $n$ ($1\leq n\leq 10^5$) standing for the number of shurikens. 

The following $2n$ lines describe the events in the format described above. It's guaranteed that there are exactly $n$ events of the first type, and each price from $1$ to $n$ occurs exactly once in the events of the second type.


-----Output-----

If the list is consistent, print "YES". Otherwise (that is, if the list is contradictory and there is no valid order of shurikens placement), print "NO".

In the first case the second line must contain $n$ space-separated integers denoting the prices of shurikens in order they were placed. If there are multiple answers, print any.


-----Examples-----
Input
4
+
+
- 2
+
- 3
+
- 1
- 4

Output
YES
4 2 3 1 

Input
1
- 1
+

Output
NO

Input
3
+
+
+
- 2
- 1
- 3

Output
NO



-----Note-----

In the first example Tenten first placed shurikens with prices $4$ and $2$. After this a customer came in and bought the cheapest shuriken which costed $2$. Next, Tenten added a shuriken with price $3$ on the showcase to the already placed $4$-ryo. Then a new customer bought this $3$-ryo shuriken. After this she added a $1$-ryo shuriken. Finally, the last two customers bought shurikens $1$ and $4$, respectively. Note that the order $[2, 4, 3, 1]$ is also valid.

In the second example the first customer bought a shuriken before anything was placed, which is clearly impossible.

In the third example Tenten put all her shurikens onto the showcase, after which a customer came in and bought a shuriken with price $2$. This is impossible since the shuriken was not the cheapest, we know that the $1$-ryo shuriken was also there.

Difficulty: MEDIUM_HARD

Solutions:
l = []
n = int(input())
for _ in range(2 * n):
	l.append(input())
stk = []
visited = [False] * n
f = True
ans = []
for i in reversed(l):
	if i[0] == '+':
		if len(stk) == 0:
			f = False
			break
		t = stk.pop()
		ans.append(t)
		if visited[t - 1]:
			f = False
			break
		visited[t - 1] = True
	else:
		t = int(i[2:])
		if visited[t - 1]:
			f = False
			break
		if len(stk) > 0 and stk[-1] < t:
			f = False
			break
		stk.append(t)
if len(stk) != 0:
	f = False
if f:
	print('YES')
	print(*reversed(ans))
else:
	print('NO')


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
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')

class SegmentTree:

	def __init__(self, data, default=-10 ** 6, 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 SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(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)
MOD = 10 ** 9 + 7

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
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(50001)]
pp = []

def SieveOfEratosthenes(n=50000):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for i in range(50001):
		if prime[i]:
			pp.append(i)
import heapq
data = []
for i in range(2 * int(input())):
	data.append(input().split())
avalible = []
result = []
try:
	for i in data[::-1]:
		if i[0] == '-':
			heapq.heappush(avalible, int(i[1]))
		else:
			m = heapq.heappop(avalible)
			result.append(m)
	result = result[::-1]
	avalible = []
	p = 0
	for i in data:
		if i[0] == '-':
			m = heapq.heappop(avalible)
			if m != int(i[1]):
				print('NO')
				sys.exit()
		else:
			heapq.heappush(avalible, result[p])
			p += 1
except Exception:
	print('NO')
	sys.exit()
print('YES')
print(*result)


class F:

	def __init__(self, x):
		self.bit = x
		for i in range(len(x)):
			j = i | i + 1
			if j < len(x):
				x[j] += x[i]

	def update(self, idx, x):
		while idx < len(self.bit):
			self.bit[idx] += x
			idx |= idx + 1

	def query(self, end):
		x = 0
		while end:
			x += self.bit[end - 1]
			end &= end - 1
		return x

	def findkth(self, k):
		idx = -1
		for d in reversed(range(len(self.bit).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(self.bit) and k >= self.bit[right_idx]:
				idx = right_idx
				k -= self.bit[idx]
		return idx + 1
import sys, io, os
Z = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
Y = lambda : print('NO') or quit()
n = int(Z())
o = [0] * n
c = 0
s = []
l = [[2 * n, 0]]
t = F([0] * n + [2 * n])
for _ in range(2 * n):
	v = Z().split()
	if len(v) > 1:
		b = int(v[1])
		if len(s) < 1 or b < l[-1][0]:
			Y()
		i = n - len(s) - t.query(len(s))
		if i + 1 < b:
			Y()
		t.update(n - b, 1)
		o[s.pop()] = b
		l[-1][1] -= 1
		if l[-1][1] < 1:
			v = l.pop()[0]
			if v > l[-1][0]:
				l[-1][0] = v
		if b > l[-1][0]:
			l[-1][0] = b
	else:
		s.append(c)
		c += 1
		if l[-1][0] > 0:
			l.append([0, 0])
		l[-1][1] += 1
print('YES')
print(' '.join(map(str, o)))


import heapq
import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))
n = int(input())
inputOrder = []
taken = [False for _ in range(n + 1)]
currLargest = n
priority = []
inputs = []
for _ in range(n * 2):
	in_ = input().split()
	inputs.append(in_)
for zz in range(n * 2 - 1, -1, -1):
	in_ = inputs[zz]
	if len(in_) == 1:
		if priority:
			temp = priority.pop()
			inputOrder.append(temp)
			taken[temp] = True
		else:
			while taken[currLargest] == True:
				currLargest -= 1
			inputOrder.append(currLargest)
			taken[currLargest] = True
	else:
		priority.append(int(in_[1]))
inputOrder.reverse()
h = []
i = 0
possible = True
for zz in range(n * 2):
	in_ = inputs[zz]
	if len(in_) == 1:
		heapq.heappush(h, inputOrder[i])
		i += 1
	else:
		v = int(in_[1])
		if len(h) == 0:
			possible = False
			break
		else:
			v2 = heapq.heappop(h)
			if v != v2:
				possible = False
				break
if possible:
	print('YES')
	oneLineArrayPrint(inputOrder)
else:
	print('NO')


from heapq import *
import sys

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

def slv():
	n = int(input())
	que = []
	heapify(que)
	a = []
	ans = []
	MIN = 0
	order = []
	for _ in range(2 * n):
		X = list(input().split(' '))
		if X[0] == '+':
			order.append(('+', 0))
		else:
			order.append(('-', int(X[1])))
	for elem in order[::-1]:
		(X0, m) = elem
		if X0 == '+':
			if not que or not a:
				print('NO')
				return
			else:
				if a[-1] != que[0]:
					print('NO')
					return
				a.pop()
				ans.append(heappop(que))
		else:
			a.append(m)
			heappush(que, m)
			continue
	print('YES')
	print(*ans[::-1])
	return
slv()


import sys, os
from io import BytesIO, IOBase
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, 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')
(stdin, stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

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

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

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

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

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
n = iinp()
seq = []
for i in range(2 * n):
	x = inp().split()
	if len(x) == 1:
		seq.append(x[0])
	else:
		seq.append(int(x[1]))
hp = []
flg = True
ansl = []
for x in seq[::-1]:
	if x == '+':
		if not hp:
			flg = False
			break
		ansl.append(heappop(hp))
	else:
		if hp:
			tmp = heappop(hp)
			if tmp < x:
				flg = False
				break
			heappush(hp, tmp)
		heappush(hp, x)
if flg:
	out('YES\n' + ' '.join(map(str, ansl[::-1])))
else:
	out('NO')


import sys
t = int(input())
c = [0] * t

def error():
	print('NO')
	raise SystemExit

def max2(a, b):
	if a > b:
		return a
	return b
v = [[10000000000.0, -1]]
index = 0
for _ in range(t + t):
	q = sys.stdin.readline()
	if q[0] == '+':
		v.append([0, index])
		index += 1
		continue
	n = int(q.split()[1])
	if v[-1][0] > n:
		error()
	c[v.pop()[1]] = n
	v[-1][0] = max2(n, v[-1][0])
print('YES')
print(' '.join(list(map(lambda x: str(x), c))))


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.buffer.readline())

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

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
from heapq import *
n = II()
hp = []
tas = [SI().split() for _ in range(2 * n)]
ans = []
for ta in tas[::-1]:
	if ta[0] == '-':
		a = int(ta[1])
		heappush(hp, a)
	else:
		if not hp:
			print('NO')
			exit()
		a = heappop(hp)
		ans.append(a)
ans = ans[::-1]

def check():
	case = []
	i = 0
	for ta in tas:
		if ta[0] == '-':
			if not case:
				return False
			a = heappop(case)
			if a != int(ta[1]):
				return False
		else:
			heappush(case, ans[i])
			i += 1
	return True
if check():
	print('YES')
	print(*ans)
else:
	print('NO')


from sys import stdin
import sys
n = int(stdin.readline())
s = []
for i in range(2 * n):
	S = stdin.readline()[:-1]
	if S[0] == '+':
		s.append(('+', None))
	else:
		(t1, t2) = S.split()
		t2 = int(t2)
		s.append(('-', t2))
q = []
ans = []
for i in range(2 * n - 1, -1, -1):
	(t, num) = s[i]
	if t == '-':
		if len(q) > 0 and q[-1] < num:
			print('NO')
			sys.exit()
		else:
			q.append(num)
	elif len(q) == 0:
		print('NO')
		sys.exit()
	else:
		ans.append(q[-1])
		del q[-1]
print('YES')
ans.reverse()
print(*ans)


import heapq
import sys
input = sys.stdin.readline
for _ in range(1):
	n = int(input())
	ans = [0] * n
	flag = 0
	mi = []
	ma = []
	cnt = -1
	heapq.heapify(mi)
	heapq.heapify(ma)
	ind = -1
	o = []
	for i in range(2 * n):
		l = list(map(str, input().split()))
		o.append(l)
		if len(l) == 1:
			ind += 1
			heapq.heappush(ma, -1 * ind)
		else:
			x = int(l[-1])
			if len(ma) != 0:
				u = -1 * heapq.heappop(ma)
				ans[u] = x
			else:
				flag = 1
	if flag:
		print('NO')
		continue
	ind = -1
	for i in o:
		l = i
		if len(l) == 1:
			ind += 1
			heapq.heappush(mi, ans[ind])
		else:
			x = int(l[-1])
			if x != mi[0]:
				flag = 1
			else:
				heapq.heappop(mi)
	if flag:
		print('NO')
		continue
	print('YES')
	print(*ans)


from heapq import *
n = int(input())
ok = True
listed = 0
queries = []
prev = -1
for i in range(2 * n):
	q = input().strip().split()
	if len(q) == 2:
		listed -= 1
		if int(q[1]) >= prev:
			prev = int(q[1])
		else:
			ok = False
			break
	else:
		listed += 1
		prev = -1
	ok &= listed >= 0
	queries.append(q)
	if not ok:
		break
if not ok:
	print('NO')
else:
	ans = []
	queue = []
	heapify(queue)
	for i in range(2 * n - 1, -1, -1):
		if len(queries[i]) == 2:
			heappush(queue, int(queries[i][1]))
		else:
			ans.append(heappop(queue))
	ptr = len(ans) - 1
	validate = []
	heapify(validate)
	for i in queries:
		if len(i) == 2:
			e = heappop(validate)
			if e != int(i[1]):
				ok = False
				break
		else:
			heappush(validate, ans[ptr])
			ptr -= 1
	if ok:
		print('YES')
		print(*ans[::-1])
	else:
		print('NO')


import sys
import heapq
input = sys.stdin.readline
data = []
for i in range(2 * int(input())):
	data.append(input().split())
q = []
result = []
for i in data[::-1]:
	if i[0] == '-':
		heapq.heappush(q, int(i[1]))
	elif q:
		m = heapq.heappop(q)
		result.append(m)
	else:
		print('NO')
		sys.exit()
result = result[::-1]
q = []
current = 0
for i in data:
	if i[0] == '-':
		m = heapq.heappop(q)
		if m != int(i[1]):
			print('NO')
			sys.exit()
	else:
		heapq.heappush(q, result[current])
		current += 1
print('YES')
print(*result)


import io
import os
from collections import Counter, defaultdict, deque

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))

def solve(N, events):
	assert len(events) == 2 * N
	ans = [-1 for i in range(2 * N)]
	place = SortedList()
	for (i, e) in enumerate(events):
		if e == -1:
			place.add(i)
	order = list(range(len(events)))
	order.sort(key=lambda i: events[i])
	for i in order:
		if events[i] > 0:
			index = place.bisect_left(i) - 1
			if index >= 0:
				j = place[index]
				del place[index]
				assert events[j] == -1
				ans[j] = events[i]
			else:
				return 'NO'
	if place:
		return 'NO'
	for (i, e) in enumerate(events):
		if e == -1:
			place.add(ans[i])
		else:
			x = place.pop(0)
			if x != e:
				return 'NO'
	return 'YES\n' + ' '.join((str(x) for x in ans if x != -1))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
(N,) = [int(x) for x in input().split()]
events = []
for i in range(2 * N):
	event = input().decode().strip()
	if event[0] == '+':
		events.append(-1)
	else:
		events.append(int(event.split(' ')[-1]))
ans = solve(N, events)
print(ans)


import sys, heapq
input = sys.stdin.readline
n = int(input())
stack = []
(f, c) = (0, 0)
res = [0 for _ in range(n)]
inp = []
for i in range(2 * n):
	s = input().strip()
	inp.append(s)
	if s[0] == '+':
		stack.append(c)
		c += 1
	elif not stack:
		f = 1
		break
	else:
		cur = stack.pop()
		res[cur] = int(s[2:])
if f == 0:
	temp = []
	(c, f) = (0, 0)
	for i in range(2 * n):
		if inp[i][0] == '+':
			heapq.heappush(temp, res[c])
			c += 1
		elif int(inp[i][2:]) != heapq.heappop(temp):
			f = 1
			break
	if f == 0:
		sys.stdout.write('YES' + '\n')
		for i in res:
			sys.stdout.write(str(i) + ' ')
	else:
		sys.stdout.write('NO' + '\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(RL())

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 // gcd(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()
	rec = [-1 for _ in range(n)]
	st = []
	now = 0
	al = []
	for _ in range(2 * n):
		s = input()
		al.append(s)
		if s[0] == '+':
			st.append(now)
			now += 1
		else:
			pric = int(s[2:])
			if not st:
				print('NO')
				break
			ind = st.pop()
			rec[ind] = pric
	else:
		ind = 0
		hp = []
		for i in al:
			if i[0] == '+':
				heappush(hp, rec[ind])
				ind += 1
			else:
				now = heappop(hp)
				if int(i[2:]) != now:
					print('NO')
					break
		else:
			print('YES')
			print(*rec)
main()


import sys
import os
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
N = int(input())
ans = [None] * N
(empty_pos, ok) = (deque(), False)
monoidx = 0
for tt in range(2 * N):
	inp = input()
	if inp[0] == '+':
		empty_pos.append(monoidx)
		monoidx += 1
	else:
		(_, num) = inp.split()
		num = int(num)
		if not empty_pos:
			break
		idx = empty_pos.pop()
		if idx < N - 1 and (ans[idx + 1] is not None and ans[idx + 1] > num):
			break
		ans[idx] = num
else:
	ok = True and all(ans) and (len(set(ans)) == N)
if not ok:
	print('NO')
else:
	print('YES')
	print(*ans)


import sys
input = sys.stdin.readline
import heapq
n = int(input())
tmp = [list(input().split()) for i in range(2 * n)]
info = [-1] * (2 * n)
for (i, q) in enumerate(tmp):
	if q[0] == '-':
		val = int(q[1])
		info[i] = val
hq = []
p = [-1] * (2 * n)
i = 2 * n
for val in info[::-1]:
	i -= 1
	if val != -1:
		heapq.heappush(hq, val)
	else:
		if not hq:
			print('NO')
			exit()
		val = heapq.heappop(hq)
		p[i] = val
hq = []
res = []
for i in range(2 * n):
	if p[i] != -1:
		heapq.heappush(hq, p[i])
		res.append(p[i])
	else:
		val = heapq.heappop(hq)
		if val != info[i]:
			print('NO')
			exit()
print('YES')
print(' '.join(map(str, res)))


import sys
import heapq
input = sys.stdin.readline
data = []
for i in range(2 * int(input())):
	data.append(input().split())
avalible = []
result = []
try:
	for i in data[::-1]:
		if i[0] == '-':
			heapq.heappush(avalible, int(i[1]))
		else:
			m = heapq.heappop(avalible)
			result.append(m)
	result = result[::-1]
	avalible = []
	p = 0
	for i in data:
		if i[0] == '-':
			m = heapq.heappop(avalible)
			if m != int(i[1]):
				print('NO')
				sys.exit()
		else:
			heapq.heappush(avalible, result[p])
			p += 1
except Exception:
	print('NO')
	sys.exit()
print('YES')
print(*result)


n = int(input())
ans = [0] * n
val = []
st = []
temp = 'YES'
c = -1
for _ in range(0, 2 * n):
	s = input().split()
	if s[0] == '+':
		c += 1
		st.append(0)
		val.append(c)
	else:
		tt = int(s[1])
		if len(st) == 0:
			temp = 'NO'
		else:
			if st[-1] > tt:
				temp = 'NO'
			ptr = val.pop()
			ans[ptr] = tt
			tt2 = st.pop()
			if len(st) > 0:
				st[-1] = max(st[-1], tt, tt2)
print(temp)
if temp == 'YES':
	print(*ans)


from bisect import bisect_right, bisect_left
import sys
input = sys.stdin.readline

def main():
	n = int(input())
	pm = 0
	lst = []
	for _ in range(2 * n):
		s = input().strip().split()
		if s[0] == '+':
			pm += 1
			lst.append(-1)
		else:
			pm -= 1
			lst.append(int(s[1]))
			if pm < 0:
				print('NO')
				return
	ans = []
	que = []
	for i in lst[::-1]:
		if i == -1:
			ans.append(que.pop())
		else:
			if que and que[-1] < i:
				print('NO')
				return
			que.append(i)
	print('YES')
	print(*ans[::-1])
main()


import sys, bisect
input = sys.stdin.readline
n = int(input())
sell = []
pos = [-1 for i in range(n)]
rest_left = [i - 1 for i in range(2 * n)]
rest_right = [i + 1 for i in range(2 * n)]
for i in range(2 * n):
	s = input().split()
	if s[0] == '+':
		continue
	else:
		sell.append(i)
		pos[int(s[1]) - 1] = len(sell) - 1
left = [i - 1 for i in range(n)]
right = [i + 1 for i in range(n)]
res = [-1 for i in range(2 * n)]
for i in range(n):
	R = sell[pos[i]]
	if left[pos[i]] != -1:
		L = sell[left[pos[i]]]
	else:
		L = -1
	sold = rest_left[R]
	if L < sold:
		res[sold] = i + 1
		if rest_right[sold] < 2 * n:
			rest_left[rest_right[sold]] = rest_left[sold]
		if rest_left[sold] != -1:
			rest_right[rest_left[sold]] = rest_right[sold]
		if rest_right[R] < 2 * n:
			rest_left[rest_right[R]] = rest_left[R]
		if rest_left[sold] != -1:
			rest_right[rest_left[R]] = rest_right[R]
		if right[pos[i]] < n:
			left[right[pos[i]]] = left[pos[i]]
		if left[pos[i]] != -1:
			right[left[pos[i]]] = right[pos[i]]
	else:
		exit(print('NO'))
ans = []
for a in res:
	if a != -1:
		ans.append(a)
print('YES')
print(*ans)


import sys
import heapq
input = sys.stdin.readline

def main():
	N = int(input())
	S = [[x for x in input().split()] for _ in range(2 * N)]
	q = []
	ans = []
	for s in S[::-1]:
		if s[0] == '-':
			heapq.heappush(q, int(s[1]))
		elif q:
			c = heapq.heappop(q)
			ans.append(c)
		else:
			print('NO')
			return
	ans2 = ans[::-1]
	q = []
	current = 0
	for s in S:
		if s[0] == '-':
			c = heapq.heappop(q)
			if c != int(s[1]):
				print('NO')
				return
		else:
			heapq.heappush(q, ans2[current])
			current += 1
	print('YES')
	print(*ans2)
main()


import sys
input = sys.stdin.readline
n = int(input())
a = [0] * n
q = []
limit = []
cnt = 0
vio = False
query = []
for i in range(2 * n):
	query.append(input())
for i in range(2 * n):
	if len(query[i]) == 2:
		q.append(cnt)
		cnt += 1
		if len(limit) > 0 and limit[-1][0] == 1:
			limit[-1][1] += 1
		else:
			limit.append([1, 1])
	else:
		(m, x) = query[i].split()
		if len(limit) == 0 or limit[-1][0] > int(x):
			vio = True
			break
		p = q.pop()
		a[p] = int(x)
		limit[-1][1] -= 1
		c = 0
		while len(limit) > 0 and limit[-1][0] <= int(x) + 1:
			c += limit[-1][1]
			limit.pop()
		if c != 0:
			limit.append([int(x) + 1, c])
if vio:
	print('NO')
else:
	print('YES')
	print(*a)


def read_seq(v):
	seq = []
	for i in range(2 * v):
		s = input().split()
		if len(s) == 2:
			s[1] = int(s[1])
		seq.append(s)
	return seq

def solve():
	n = int(input())
	pos = [-1] * (2 * n)
	stack = []
	seq = read_seq(n)
	for (i, act) in enumerate(seq):
		if act[0] == '+':
			stack.append(i)
		elif not stack:
			return None
		else:
			v = stack.pop()
			pos[v] = act[1]
	if stack:
		return None
	stack = []
	for (i, act) in enumerate(seq):
		if act[0] == '+':
			if stack and stack[-1] < pos[i]:
				return None
			else:
				stack.append(pos[i])
		else:
			stack.pop()
	return [x for x in pos if x != -1]

def main():
	res = solve()
	if res:
		print('YES')
		print(' '.join(map(str, res)))
	else:
		print('NO')
main()


import sys
readline = sys.stdin.readline
from heapq import heappop as hpp, heappush as hp
N = int(readline())
ev = [None] * (2 * N)
pl = []
ans = 'YES'
for i in range(2 * N):
	s = readline().strip()
	if s[0] == '+':
		pl.append(i)
	elif not pl:
		ans = 'NO'
	else:
		b = int(s.split()[1])
		ev[i] = b
		ev[pl.pop()] = -b
if ans == 'NO':
	print(ans)
else:
	Q = []
	for i in ev:
		if i < 0:
			i = -i
			hp(Q, i)
		elif i != hpp(Q):
			ans = 'NO'
			break
	print(ans)
	if ans == 'YES':
		print(*[-i for i in ev if i < 0])


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.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(io.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()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from heapq import heappush, heappop
n = int(input())
ops = [input() for _ in range(n + n)]
queue = []
ans = []
for i in range(2 * n - 1, -1, -1):
	if ops[i][0] == '+':
		if not queue:
			print('NO')
			exit(0)
		ans.append(heappop(queue))
	else:
		val = int(ops[i].split()[1])
		if queue and val > queue[0]:
			print('NO')
			exit(0)
		heappush(queue, val)
print('YES')
print(' '.join((str(x) for x in reversed(ans))))


import math
PLUS = '+'
MINUS = '-'

def solve():
	n = int(input())
	sales = []
	for _ in range(2 * n):
		sales.append(input().split(' '))
	min_queue = []
	res = []
	for i in range(2 * n - 1, -1, -1):
		if sales[i][0] == MINUS:
			current_sale = int(sales[i][1])
			if len(min_queue) == 0 or current_sale < min_queue[-1]:
				min_queue.append(int(sales[i][1]))
			else:
				return ('NO', None)
		elif len(min_queue) == 0:
			return ('NO', None)
		else:
			res.append(min_queue.pop())
	return ('YES', res[::-1])
(a, b) = solve()
print(a)
if b != None:
	print(' '.join(map(str, b)))