There are $n$ children numbered from $1$ to $n$ in a kindergarten. Kindergarten teacher gave $a_i$ ($1 \leq a_i \leq n$) candies to the $i$-th child. Children were seated in a row in order from $1$ to $n$ from left to right and started eating candies. 

While the $i$-th child was eating candies, he calculated two numbers $l_i$ and $r_i$ — the number of children seating to the left of him that got more candies than he and the number of children seating to the right of him that got more candies than he, respectively.

Formally, $l_i$ is the number of indices $j$ ($1 \leq j < i$), such that $a_i < a_j$ and $r_i$ is the number of indices $j$ ($i < j \leq n$), such that $a_i < a_j$.

Each child told to the kindergarten teacher the numbers $l_i$ and $r_i$ that he calculated. Unfortunately, she forgot how many candies she has given to each child. So, she asks you for help: given the arrays $l$ and $r$ determine whether she could have given the candies to the children such that all children correctly calculated their values $l_i$ and $r_i$, or some of them have definitely made a mistake. If it was possible, find any way how she could have done it.


-----Input-----

On the first line there is a single integer $n$ ($1 \leq n \leq 1000$) — the number of children in the kindergarten.

On the next line there are $n$ integers $l_1, l_2, \ldots, l_n$ ($0 \leq l_i \leq n$), separated by spaces.

On the next line, there are $n$ integer numbers $r_1, r_2, \ldots, r_n$ ($0 \leq r_i \leq n$), separated by spaces.


-----Output-----

If there is no way to distribute the candies to the children so that all of them calculated their numbers correctly, print «NO» (without quotes).

Otherwise, print «YES» (without quotes) on the first line. On the next line, print $n$ integers $a_1, a_2, \ldots, a_n$, separated by spaces — the numbers of candies the children $1, 2, \ldots, n$ received, respectively. Note that some of these numbers can be equal, but all numbers should satisfy the condition $1 \leq a_i \leq n$. The number of children seating to the left of the $i$-th child that got more candies than he should be equal to $l_i$ and the number of children seating to the right of the $i$-th child that got more candies than he should be equal to $r_i$. If there is more than one solution, find any of them.


-----Examples-----
Input
5
0 0 1 1 2
2 0 1 0 0

Output
YES
1 3 1 2 1

Input
4
0 0 2 0
1 1 1 1

Output
NO

Input
3
0 0 0
0 0 0

Output
YES
1 1 1



-----Note-----

In the first example, if the teacher distributed $1$, $3$, $1$, $2$, $1$ candies to $1$-st, $2$-nd, $3$-rd, $4$-th, $5$-th child, respectively, then all the values calculated by the children are correct. For example, the $5$-th child was given $1$ candy, to the left of him $2$ children were given $1$ candy, $1$ child was given $2$ candies and $1$ child — $3$ candies, so there are $2$ children to the left of him that were given more candies than him.

In the second example it is impossible to distribute the candies, because the $4$-th child made a mistake in calculating the value of $r_4$, because there are no children to the right of him, so $r_4$ should be equal to $0$.

In the last example all children may have got the same number of candies, that's why all the numbers are $0$. Note that each child should receive at least one candy.

Difficulty: MEDIUM

Solutions:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = [0] * n
ans = True
for i in range(n):
	ans = ans and a[i] <= i and (b[i] <= n - i - 1)
	s[i] = n - a[i] - b[i]

def qwe(s, j):
	(l, r) = (0, 0)
	for i in range(len(s)):
		if i < j and s[i] > s[j]:
			l += 1
		elif i > j and s[i] > s[j]:
			r += 1
	return (l, r)
if ans:
	for i in range(n):
		(l, r) = qwe(s, i)
		ans = ans and a[i] == l and (b[i] == r)
if ans:
	print('YES')
	for i in range(n):
		print(n - a[i] - b[i], end=' ')
else:
	print('NO')


R = lambda : list(map(int, input().split()))
n = int(input())
l = R()
r = R()
q = []
for i in range(n):
	q.append(n - l[i] - r[i])
fl = True
for i in range(n):
	lx = 0
	rx = 0
	for j in range(n):
		if q[i] < q[j]:
			if i < j:
				rx += 1
			else:
				lx += 1
	if lx != l[i] or rx != r[i]:
		fl = False
		break
if not fl:
	print('NO')
else:
	print('YES')
	print(' '.join((str(e) for e in q)))


n = int(input())
l = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
flag = 1
a = [n - l[i] - r[i] for i in range(n)]
for i in range(n):
	cl = 0
	cr = 0
	for j in range(i):
		if a[j] > a[i]:
			cl += 1
	for k in range(i + 1, n):
		if a[k] > a[i]:
			cr += 1
	if cl != l[i] or cr != r[i]:
		print('NO')
		flag = 0
		break
if flag:
	print('YES')
	print(*a)


def main():
	n = int(input())
	left = [int(x) for x in input().strip().split()]
	right = [int(x) for x in input().strip().split()]
	rank = [x + y for (x, y) in zip(left, right)]
	arr = [n - r for r in rank]
	for i in range(n):
		more = 0
		for j in range(i):
			if arr[j] > arr[i]:
				more += 1
		if more != left[i]:
			print('NO')
			return
	for i in range(n):
		more = 0
		for j in range(i + 1, n):
			if arr[j] > arr[i]:
				more += 1
		if more != right[i]:
			print('NO')
			return
	print('YES')
	for x in arr:
		print(x, end=' ')
	print()

def __starting_point():
	main()
__starting_point()


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
c = [n] * n
for i in range(n):
	c[i] -= r[i] + l[i]
for i in range(n):
	m = 0
	for j in range(0, i):
		if c[j] > c[i]:
			m += 1
	if m != l[i]:
		exit(print('NO'))
for i in range(n):
	m = 0
	for j in range(i + 1, n):
		if c[j] > c[i]:
			m += 1
	if m != r[i]:
		exit(print('NO'))
print('YES')
print(*c)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = [0] * n
for i in range(n):
	a[i] = n - (l[i] + r[i])
flag = True
for i in range(n):
	tmp = 0
	for j in range(i + 1, n):
		if a[i] < a[j]:
			tmp += 1
	if tmp != r[i]:
		flag = False
		break
	tmp = 0
	for j in range(i):
		if a[i] < a[j]:
			tmp += 1
	if tmp != l[i]:
		flag = False
		break
if flag:
	print('YES')
	print(' '.join(map(str, a)))
else:
	print('NO')


3.5
N = int(input())
L = [int(s) for s in input().split(' ')]
R = [int(s) for s in input().split(' ')]
C = [N - L[i] - R[i] for i in range(0, N)]
for (i, x) in enumerate(C):
	if C[i] <= 0:
		print('NO')
		return
	l = 0
	r = 0
	j = i - 1
	while j >= 0:
		if C[j] > C[i]:
			l = l + 1
		j = j - 1
	j = i + 1
	while j < N:
		if C[j] > C[i]:
			r = r + 1
		j = j + 1
	if L[i] != l or R[i] != r:
		print('NO')
		return
print('YES')
for i in range(0, N - 1):
	print(C[i], end=' ')
print(C[N - 1])


n = int(input())
a = list(map(int, input().split()))
s = list(map(int, input().split()))
d = []
for q in range(n):
	d.append(a[q] + s[q])
d = [n - q for q in d]
for q in range(n):
	f = 0
	for q1 in range(q):
		if d[q1] > d[q]:
			f += 1
	g = 0
	for q1 in range(q + 1, n):
		if d[q1] > d[q]:
			g += 1
	if f != a[q] or g != s[q]:
		print('NO')
		break
else:
	print('YES')
	print(*d)


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, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		l = ria()
		r = ria()
		c = []
		for i in range(n):
			c.append([l[i] + r[i], i])
		c = sorted(c)
		ans = [0] * n
		for i in c:
			ans[i[1]] = n - i[0]
		f = 0
		for i in range(n):
			k = 0
			for j in range(i):
				if ans[j] > ans[i]:
					k += 1
			if k != l[i]:
				f = 1
				break
			k = 0
			for j in range(i + 1, n):
				if ans[j] > ans[i]:
					k += 1
			if k != r[i]:
				f = 1
				break
		if f == 0:
			print('YES')
			print(*ans)
		else:
			print('NO')
	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()


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
u = [0] * n
for i in range(n):
	u[i] = n - r[i] - l[i]
ok = True
for i in range(n):
	kl = 0
	kr = 0
	for j in range(n):
		if u[j] > u[i]:
			if j < i:
				kl += 1
			else:
				kr += 1
	if kl != l[i] or kr != r[i]:
		ok = False
		break
if ok:
	print('YES')
	print(' '.join(map(str, u)))
else:
	print('NO')


n = int(input())
l = list(map(int, input().split(' ')))
r = list(map(int, input().split(' ')))
slr = [l[i] + r[i] for i in range(n)]
ans = [n - slr[i] for i in range(n)]
flag = True
if l[0] != 0 or r[n - 1] != 0:
	flag = False
for i in range(n):
	great = 0
	for j in range(i + 1, n):
		if ans[i] < ans[j]:
			great = great + 1
	if r[i] != great:
		flag = False
		break
for i in range(n - 1, -1, -1):
	great = 0
	for j in range(i - 1, -1, -1):
		if ans[i] < ans[j]:
			great = great + 1
	if l[i] != great:
		flag = False
		break
if flag:
	print('YES')
	for i in range(0, n - 1):
		print(ans[i], end=' ')
	print(ans[n - 1])
else:
	print('NO')


n = int(input())
l = list(map(int, input().split(' ')))
r = list(map(int, input().split(' ')))
d = {}
a = []
f = 0
for i in range(n):
	d[i] = n - i
for i in range(n):
	if l[i] + r[i] < n:
		a.append(d[l[i] + r[i]])
	else:
		f = 1
if f == 0:
	f = 0
	for i in range(n):
		x = a[i]
		c = 0
		for j in range(i + 1):
			if a[j] > x:
				c += 1
		if c != l[i]:
			f = 1
			break
	for i in range(n):
		x = a[i]
		c = 0
		for j in range(i + 1, n):
			if a[j] > x:
				c += 1
		if c != r[i]:
			f = 1
			break
	if f == 1:
		print('NO')
	else:
		print('YES')
		print(*a)
else:
	print('NO')


import sys
import math
import collections
import heapq
import decimal
input = sys.stdin.readline
n = int(input())
l = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
ans = [n - l[i] - r[i] for i in range(n)]
c = 1
for i in range(n):
	(c1, c2) = (0, 0)
	for j in range(i):
		if ans[j] > ans[i]:
			c1 += 1
	for j in range(i + 1, n):
		if ans[j] > ans[i]:
			c2 += 1
	if c1 != l[i] or c2 != r[i]:
		c = 0
		break
if c == 1:
	print('YES')
	print(*ans)
else:
	print('NO')


n = int(input())
left = list(map(int, input().split()))
right = list(map(int, input().split()))
check = []
for i in range(len(left)):
	check.append(n - (left[i] + right[i]))
l1 = []
r1 = []
for i in range(len(check)):
	count = 0
	for j in range(i + 1, len(check)):
		if check[j] > check[i]:
			count += 1
	r1.append(count)
for i in range(len(check)):
	count = 0
	for j in range(i):
		if check[j] > check[i]:
			count += 1
	l1.append(count)
if l1 == left and r1 == right:
	print('YES')
	print(*check)
else:
	print('NO')


n = int(input())
l = tuple(map(int, input().split()))
r = tuple(map(int, input().split()))
s = [(i, sum(v)) for (i, v) in enumerate(zip(l, r))]
ss = sorted(s, key=lambda a: a[1])
candies = [0] * n
for p in ss:
	candies[p[0]] = n - p[1]
ll = [0]
for i in range(1, n):
	ll.append(sum([1 for c in candies[:i] if c > candies[i]]))
rr = [0]
for i in range(n - 2, -1, -1):
	rr.append(sum([1 for c in candies[i:] if c > candies[i]]))
for i in range(n):
	if ll[i] != l[i]:
		print('NO')
		break
	if rr[n - 1 - i] != r[i]:
		print('NO')
		break
	if i == n - 1:
		print('YES')
		print(' '.join(map(str, candies)))


n = int(input())
left = list(map(int, input().split()))
right = list(map(int, input().split()))
arr = [n - left[i] - right[i] for i in range(n)]

def check(l, r, pos):
	if sum((elem > arr[pos] for elem in arr[pos + 1:])) != r:
		return False
	if sum((elem > arr[pos] for elem in arr[:pos])) != l:
		return False
	return True
for i in range(n):
	if not check(left[i], right[i], i):
		print('NO')
		exit()
print('YES')
print(*arr)


R = lambda : map(int, input().split())
n = int(input())
a = list(R())
b = list(R())
L = [n - a[i] - b[i] for i in range(n)]
for i in range(n):
	c = 0
	for j in range(i):
		if L[j] > L[i]:
			c += 1
	if c != a[i]:
		print('NO')
		quit()
for i in reversed(range(n)):
	c = 0
	for j in range(n - 1, i, -1):
		if L[j] > L[i]:
			c += 1
	if c != b[i]:
		print('NO')
		quit()
print('YES')
print(*L)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
fl = 0
m = n
s = list(range(n))
for i in range(n):
	s[i] = m - (l[i] + r[i])
	if fl != 1 and s[i] == m:
		fl = 1
for i in range(n):
	ll = 0
	for j in range(i):
		if s[j] > s[i]:
			ll += 1
	rr = 0
	for j in range(i + 1, n):
		if s[j] > s[i]:
			rr += 1
	if l[i] != ll or rr != r[i]:
		fl = 0
		break
if fl == 1 and l[0] == 0 and (r[n - 1] == 0):
	print('YES')
	print(*s)
else:
	print('NO')


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
testcases = 1
for _ in range(testcases):
	n = vary(1)
	l = array_int()
	r = array_int()
	arr = []
	for i in range(n):
		arr.append(n - l[i] - r[i])
	for i in range(n):
		left = right = 0
		for j in range(n):
			if i == j:
				continue
			elif j < i:
				left += 1 if arr[i] < arr[j] else 0
			else:
				right += 1 if arr[i] < arr[j] else 0
		if left == l[i] and right == r[i]:
			continue
		else:
			print('NO')
			break
	else:
		print('YES')
		print(*arr)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = [[l[i] + r[i], i] for i in range(n)]
a.sort()
candies = [0 for i in range(n)]
if a[0][0] != 0:
	print('NO')
	return
else:
	candies[a[0][1]] = n - a[0][0]
for i in range(1, n):
	if a[i][0] != a[i - 1][0] and a[i][0] != i:
		print('NO')
		return
	candies[a[i][1]] = n - a[i][0]
for i in range(n):
	l1 = 0
	r1 = 0
	for j in range(i):
		if candies[j] > candies[i]:
			l1 += 1
	for j in range(i + 1, n):
		if candies[j] > candies[i]:
			r1 += 1
	if l1 != l[i] or r1 != r[i]:
		print('NO')
		return
print('YES')
print(*candies)


n = int(input())
c = []
d = []
a1 = []
b1 = []
check = 1
a = list(map(int, input().split()))
b = list(map(int, input().split()))
for i in range(n):
	c.append(a[i] + b[i])
for i in c:
	d.append(n - i)
for i in range(n):
	j = i
	l = 0
	r = 0
	for j in range(i, n):
		if d[i] < d[j]:
			r += 1
	b1.append(r)
	j = 0
	for j in range(i + 1):
		if d[i] < d[j]:
			l += 1
	a1.append(l)
for i in range(n):
	if a[i] != a1[i] or b[i] != b1[i]:
		check += 1
if check == 1:
	print('YES')
	for j in range(n):
		print(d[j], end=' ')
else:
	print('NO')


for _ in range(1):
	n = int(input())
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	l = [0] * n
	for i in range(n):
		l[i] = n - l1[i] - l2[i]
	for i in range(n):
		cl = 0
		cr = 0
		for j in range(i):
			if l[j] > l[i]:
				cl += 1
		for k in range(i + 1, n):
			if l[k] > l[i]:
				cr += 1
		if cl != l1[i] or cr != l2[i]:
			print('NO')
			exit()
	print('YES')
	print(*l)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = []
k = 0
l1 = []
r1 = []
for i in range(n):
	if l[i] > i or r[i] > n - i - 1:
		print('NO')
		break
	a.append(n - l[i] - r[i])
if len(a) == n:
	for i in range(n):
		for j in range(i):
			if a[i] < a[j]:
				k += 1
		l1.append(k)
		k = 0
		for j in range(i + 1, n):
			if a[i] < a[j]:
				k += 1
		r1.append(k)
		k = 0
	if l1 == l and r1 == r:
		print('YES')
		print(*a)
	else:
		print('NO')


n = int(input())
l = [int(x) for x in input().split()]
r = [int(y) for y in input().split()]
result = [0] * n
for i in range(n):
	result[i] = n - l[i] - r[i]
for i in range(n):
	flag = 0
	for j in range(i):
		if result[j] > result[i]:
			flag += 1
	if flag != l[i]:
		print('NO')
		exit()
	flag = 0
	for j in range(i + 1, n):
		if result[j] > result[i]:
			flag += 1
	if flag != r[i]:
		print('NO')
		exit()
print('YES')
print(*result)


import math as ma
import sys
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

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

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

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = nu()
a = li()
b = li()
z = []
for i in range(n):
	z.append((a[i] + b[i], i))
z.sort()
fl = True
x = []
cc = 0
xp = 0
mp = {}
np = []
for i in range(n):
	if a[i] > i:
		fl = False
	if b[i] > n - i - 1:
		fl = False
	if n - a[i] - b[i] <= 0:
		fl = False
if fl == False:
	print('NO')
else:
	zz = [0] * n
	for i in range(n):
		zz[i] = n - a[i] - b[i]
	for i in range(n):
		xl = 0
		xr = 0
		for j in range(i + 1, n):
			if zz[j] > zz[i]:
				xr += 1
		for j in range(i - 1, -1, -1):
			if zz[j] > zz[i]:
				xl += 1
		if xl != a[i] or xr != b[i]:
			fl = False
			break
	if fl == True:
		print('YES')
		print(*zz)
	else:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
k = []
for i in range(n):
	k.append(n - l[i] - r[i])
err = False
for i in range(n):
	lk = rk = 0
	for j in range(i):
		if k[j] > k[i]:
			lk += 1
	for j in range(i + 1, n):
		if k[j] > k[i]:
			rk += 1
	if l[i] != lk or r[i] != rk:
		err = True
		break
if err:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, k)))


t = int(input())
str1 = [int(x) for x in input().split()]
str2 = [int(x) for x in input().split()]
arr = []
for i in range(0, t):
	num = t - str1[i] - str2[i]
	arr.append(num)
pro = 0
for i in range(0, t):
	temp = 0
	for j in range(0, i):
		if arr[j] > arr[i]:
			temp += 1
	if temp != str1[i]:
		pro = 1
		break
	temp = 0
	for j in range(i + 1, t):
		if arr[j] > arr[i]:
			temp += 1
	if temp != str2[i]:
		pro = 1
		break
if pro == 0:
	print('YES')
	print(*arr)
else:
	print('NO')


gi = lambda : list(map(int, input().split()))
(n, l, r) = (gi()[0], gi(), gi())
ans = [n - l[k] - r[k] for k in range(n)]
print(['NO', 'YES\n' + ' '.join(map(str, ans))][sum([1 if sum([1 if ans[j] > ans[i] else 0 for j in range(0, i)]) == l[i] and sum([1 if ans[j] > ans[i] else 0 for j in range(i + 1, n)]) == r[i] else 0 for i in range(n)]) == n])


import sys
n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
res = [0] * n
for i in range(n):
	res[i] = n - l[i] - r[i]
for i in range(n):
	ok = 0
	for j in range(i):
		if res[j] > res[i]:
			ok += 1
	if ok != l[i]:
		print('NO')
		sys.exit(0)
	ok = 0
	for j in range(i + 1, n):
		if res[j] > res[i]:
			ok += 1
	if ok != r[i]:
		print('NO')
		sys.exit(0)
print('YES')
print(' '.join(map(str, res)))


from fractions import Fraction
n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
flag = True
arr = [n] * n
for i in range(n):
	arr[i] -= l[i] + r[i]
for i in range(n):
	l[i] -= sum((1 for j in range(i) if arr[j] > arr[i]))
	r[i] -= sum((1 for j in range(i + 1, n) if arr[j] > arr[i]))
	if l[i] or r[i]:
		flag = False
		break
if flag:
	print('YES')
	print(*arr)
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
candies = []
for i in range(n):
	candies.append(n - l[i] - r[i])
left = []
for i in range(n):
	guys = 0
	for j in range(i):
		if candies[j] > candies[i]:
			guys += 1
	left.append(guys)
right = []
for i in range(n):
	guys = 0
	for j in range(i, n):
		if candies[j] > candies[i]:
			guys += 1
	right.append(guys)
if left == l and right == r:
	print('YES')
	candiesstr = ''
	for i in range(n):
		candiesstr += str(candies[i]) + ' '
	print(candiesstr[:len(candiesstr) - 1])
else:
	print('NO')


n = int(input())
l = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
a = [0] * n
for i in range(n):
	a[i] = n - (l[i] + r[i])
	if a[i] < 0:
		print('NO')
		exit(0)
for i in range(n):
	max_l = 0
	max_r = 0
	for j in range(i):
		if a[j] > a[i]:
			max_l += 1
	for j in range(i + 1, n):
		if a[j] > a[i]:
			max_r += 1
	if max_l != l[i] or max_r != r[i]:
		print('NO')
		exit(0)
print('YES')
for x in a:
	print(x, end=' ')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
ans = [0] * n
flag = True
for i in range(n):
	if i - l[i] < 0 or i + r[i] >= n:
		flag = False
		break
	else:
		ans[i] = n - l[i] - r[i]
for check in range(n):
	(les, mor) = (0, 0)
	for element in range(n):
		if check == element:
			continue
		elif check < element:
			if ans[check] < ans[element]:
				les += 1
		elif check > element:
			if ans[check] < ans[element]:
				mor += 1
	if l[check] != mor or r[check] != les:
		flag = False
if flag:
	print('YES')
	print(' '.join(map(str, ans)))
else:
	print('NO')


import math
from decimal import Decimal
import heapq

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 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 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)
(n, a) = na()
b = list(map(int, input().split()))
ans = []
for i in range(n):
	ans.append(n - a[i] - b[i])
for i in range(n):
	tc = 0
	for j in range(i):
		tc += ans[i] < ans[j]
	if tc != a[i]:
		print('NO')
		exit()
	tc = 0
	for j in range(i + 1, n):
		tc += ans[i] < ans[j]
	if tc != b[i]:
		print('NO')
		exit()
else:
	print('YES')
	print(*ans)


n = int(input())
l = [int(v) for v in input().split()]
r = [int(v) for v in input().split()]
q = [n - l[j] - r[j] for j in range(n)]
f = 0
for j in range(n):
	c = 0
	for k in range(0, j):
		if q[k] > q[j]:
			c = c + 1
	if c != l[j]:
		f = 1
		break
	c = 0
	for k in range(j + 1, n):
		if q[k] > q[j]:
			c = c + 1
	if c != r[j]:
		f = 1
		break
if f == 0:
	print('YES')
	print(' '.join(map(str, q)))
else:
	print('NO')


n = int(input())
left = input().split()
right = input().split()
ans = []
if left[0] != '0' or right[n - 1] != '0':
	print('NO')
	exit()
for i in range(n):
	flag = True
	ans.append(n - int(left[i]) - int(right[i]))
	if ans[i] <= 0 or int(left[i]) + int(right[i]) >= n:
		flag = False
for i in range(n):
	countl = 0
	countr = 0
	for j in range(i - 1, -1, -1):
		if ans[j] > ans[i]:
			countl += 1
	for j in range(i + 1, n):
		if ans[j] > ans[i]:
			countr += 1
	if countl != int(left[i]) or countr != int(right[i]):
		break
if i == n - 1 and flag:
	print('YES')
	for i in range(n):
		print(ans[i], end=' ')
else:
	print('NO')


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = []
for i in range(a):
	t = a - b[i] - c[i]
	d.append(t)
flag = 0
for i in range(a):
	t = 0
	for j in range(i):
		if d[j] > d[i]:
			t += 1
	if t != b[i]:
		flag += 1
		break
	t = 0
	for j in range(i + 1, a):
		if d[j] > d[i]:
			t += 1
	if t != c[i]:
		flag += 1
		break
if flag == 0:
	print('YES')
	print(*d)
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = [n - (l[i] + r[i]) for i in range(n)]
for i in range(n):
	l_cnt = 0
	r_cnt = 0
	for j in range(i):
		if a[j] > a[i]:
			l_cnt += 1
	for k in range(i + 1, n):
		if a[k] > a[i]:
			r_cnt += 1
	if l_cnt != l[i] or r_cnt != r[i]:
		print('NO')
		exit()
print('YES')
print(*a)


def lr(a):
	l = [0] * len(a)
	r = [0] * len(a)
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			if a[j] > a[i]:
				r[i] += 1
			if a[i] > a[j]:
				l[j] += 1
	return (l, r)
n = int(input())
l = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
a = [0] * n
for i in range(n):
	for j in range(n):
		if l[j] + r[j] == i:
			a[j] = n - i
(l1, r1) = lr(a)
if l1 != l or r1 != r:
	print('NO')
else:
	print('YES')
	print(' '.join([str(i) for i in a]))


n = int(input())
l = input().split()
l = list(map(int, l))
r = input().split()
r = list(map(int, r))
a = []
if l[0] != 0 or r[-1] != 0:
	print('NO')
else:
	for i in range(n):
		a.append(n - l[i] - r[i])
	flag = True
	for i in range(n):
		c = 0
		for j in range(i):
			if a[j] > a[i]:
				c = c + 1
		if c != l[i]:
			print('NO')
			flag = False
			break
	if flag:
		for i in range(n):
			c = 0
			for j in range(i + 1, n):
				if a[j] > a[i]:
					c = c + 1
			if c != r[i]:
				print('NO')
				flag = False
				break
	if flag:
		print('YES')
		for i in a:
			print(i, end=' ')


n = int(input())
le = [int(i) for i in input().split()]
ri = [int(i) for i in input().split()]
notp = False
check = []
for i in range(n):
	check.append(n - le[i] - ri[i])
for i in range(n):
	tot = 0
	for j in range(i - 1, -1, -1):
		if check[j] > check[i]:
			tot += 1
	if tot != le[i]:
		notp = True
		break
if notp == False:
	for i in range(n):
		tot = 0
		for j in range(i + 1, n):
			if check[j] > check[i]:
				tot += 1
		if tot != ri[i]:
			notp = True
			break
if notp:
	print('NO')
else:
	print('YES')
	print(*check)


n = int(input())
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
t = n
ans = [0] * n
f = 0
while t > 0:
	pep = []
	for i in range(n):
		if l[i] == 0 and l1[i] == 0:
			pep.append(i)
	for j in pep:
		ans[j] = t
		l[j] = -1
		l1[j] = -1
		for k in range(0, j):
			l1[k] -= 1
		for k in range(j + 1, n):
			l[k] -= 1
	t -= len(pep)
	if len(pep) == 0 and t > 0:
		f = 1
		break
if f == 1:
	print('NO')
else:
	print('YES')
	print(*ans, sep=' ')


n = int(input())
l = [*map(int, input().split())]
r = [*map(int, input().split())]

def candy(l, r, n):
	if l[0] != 0 or r[-1] != 0:
		return 'NO'
	a = []
	for i in range(n):
		_ = n - l[i] - r[i]
		if 1 <= _ <= n:
			a.append(_)
		else:
			return 'NO'
	for i in range(n):
		for j in range(i):
			l[i] -= a[j] > a[i]
	for i in range(n):
		for j in range(i + 1, n):
			r[i] -= a[j] > a[i]
	for i in range(n):
		if l[i] != 0 or r[i] != 0:
			return 'NO'
	return 'YES\n' + ' '.join(map(str, a))
print(candy(l, r, n))


n = int(input())
left = list(map(int, input().split()))
r = list(map(int, input().split()))
ans = []
for i in range(n):
	ans.append(n - left[i] - r[i])
for num in range(n):
	count = 0
	for i in range(num + 1, n):
		if ans[i] > ans[num]:
			count += 1
	if count != r[num]:
		print('NO')
		exit()
	count = 0
	for i in range(num):
		if ans[i] > ans[num]:
			count += 1
	if count != left[num]:
		print('NO')
		exit()
print('YES')
for i in ans:
	print(i, end=' ')


R = lambda : list(map(int, input().split()))
(n, a, b) = (R()[0], R(), R())
Co = [n - k - l for (k, l) in zip(a, b)]
for i in range(n):
	p = sum((Co[o] > Co[i] for o in range(i)))
	q = sum((Co[o] > Co[i] for o in range(i + 1, n)))
	if p != a[i] or q != b[i]:
		print('NO')
		exit()
print('YES')
print(*Co)


n = int(input())
L = list(map(int, input().split()))
R = list(map(int, input().split()))
A = [n - (R[i] + L[i]) for i in range(n)]
for i in range(n):
	l = 0
	r = 0
	for j in range(i):
		if A[j] > A[i]:
			l += 1
	for j in range(i + 1, n):
		if A[j] > A[i]:
			r += 1
	if l != L[i] or r != R[i]:
		print('NO')
		exit()
print('YES')
print(*A)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = []
for i in range(n):
	a.append(n - l[i] - r[i])
for i in range(n):
	cnt = 0
	for j in range(0, i):
		cnt += a[i] < a[j]
	if cnt != l[i]:
		print('NO')
		exit(0)
	cnt = 0
	for j in range(i + 1, n):
		cnt += a[i] < a[j]
	if cnt != r[i]:
		print('NO')
		exit(0)
print('YES')
for i in range(n):
	print(a[i], end=' ')
print('')