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
Tags: Implementation

Constructive algorithms
Expected Time Complexity: O(N^2)

Starter code:

Solutions:
R = lambda : map(int, input().split())
n = int(input())
arr1 = tuple(R())
arr2 = tuple(R())
d = dict()
ans = [0] * n
for i in range(n):
	d[i] = [arr1[i], arr2[i]]

def run():
	for nn in range(n, 0, -1):
		s = list()
		for i in d:
			if d[i][0] == d[i][1] == 0:
				s.append(i)
				ans[i] = nn
		if s:
			for i in s:
				del d[i]
			for i in d:
				l = r = 0
				for j in s:
					if j < i:
						l += 1
					else:
						r += 1
				if d[i][0] >= l:
					d[i][0] -= l
				else:
					return
				if d[i][1] >= r:
					d[i][1] -= r
				else:
					return
		else:
			return
run()
if 0 in ans:
	print('NO')
else:
	print('YES')
	print(*ans, sep=' ')


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


def check(l, r):
	n = len(l)
	for i in range(n):
		if l[i] > i or r[i] > n - i - 1:
			return False
	return True

def post_check(a, l, r):
	n = len(a)
	for i in range(n - 1):
		if a[i] == a[i + 1] and (l[i] != l[i + 1] or r[i] != r[i + 1]):
			return False
		if a[i] > a[i + 1] and (l[i + 1] <= l[i] or r[i] > r[i + 1]):
			return False
		if a[i] < a[i + 1] and (l[i + 1] > l[i] or r[i] <= r[i + 1]):
			return False
	return True
n = int(input())
l = tuple(map(int, input().split(' ')))
r = tuple(map(int, input().split(' ')))
if check(l, r):
	rank = [(i, l[i] + r[i]) for i in range(n)]
	rank.sort(reverse=True, key=lambda x: x[1])
	lold = 0
	rold = 0
	counter = 0
	cand = 1
	c = [0] * n
	old = rank[0][1]
	for i in rank:
		if i[1] == old:
			c[i[0]] = cand
		else:
			cand += 1
			c[i[0]] = cand
			old = i[1]
	for i in range(n):
		new_l = sum((c[i] < c[o] for o in range(i)))
		new_r = sum((c[i] < c[o] for o in range(i, n)))
		if new_l != l[i] or new_r != r[i]:
			print('NO')
			break
	else:
		print('YES')
		print(*c)
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)


import itertools

def find(r_list, l_list):
	result_list = [-(r + l) for (r, l) in zip(r_list, l_list)]
	min_value = -min(result_list)
	return [result + min_value + 1 for result in result_list]

def validate(r_list, l_list, result_list):
	for (i, (r, l, item)) in enumerate(zip(r_list, l_list, result_list)):
		if len(tuple(itertools.islice((e for e in itertools.islice(result_list, 0, i) if e > item), l + 1))) != l:
			return False
		if len(tuple(itertools.islice((e for e in itertools.islice(result_list, i + 1, None) if e > item), r + 1))) != r:
			return False
	return True

def run():
	n = int(input())
	l = list(map(int, input().split()))
	r = list(map(int, input().split()))
	result = find(r, l)
	is_ok = validate(r, l, result)
	if is_ok:
		print('YES')
		print(*result)
	else:
		print('NO')
run()


n = int(input())
ls = list(map(int, input().split()))
rs = list(map(int, input().split()))
sums = [None for i in range(n)]
for i in range(n):
	sums[i] = (ls[i] + rs[i], i)
sums.sort()
candies = [0 for i in range(n)]
curcandy = n
for i in range(len(sums)):
	(cursum, idx) = sums[i]
	if i > 0:
		(prevsum, _) = sums[i - 1]
		if cursum != prevsum:
			curcandy -= 1
	candies[idx] = curcandy

def isvalid(idx):
	(l, r) = (0, 0)
	for i in range(n):
		if i < idx and candies[i] > candies[idx]:
			l += 1
		if i > idx and candies[i] > candies[idx]:
			r += 1
	return l == ls[idx] and r == rs[idx]
solvable = True
for i in range(n):
	if not isvalid(i):
		solvable = False
		break
if not solvable:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, candies)))


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())
larr = list(map(int, input().split()))
rarr = list(map(int, input().split()))
rez = [-1 for _ in range(n)]
x = n
mx = list(filter(lambda i: larr[i] == rarr[i] == 0 and rez[i] == -1, range(n)))
while mx:
	for i in mx:
		rez[i] = x
	rd = 0
	for i in range(n):
		if rez[i] == x:
			rd += 1
		elif rez[i] == -1:
			larr[i] -= rd
	ld = 0
	for i in reversed(range(n)):
		if rez[i] == x:
			ld += 1
		elif rez[i] == -1:
			rarr[i] -= ld
	x -= 1
	mx = list(filter(lambda i: larr[i] == rarr[i] == 0 and rez[i] == -1, range(n)))
if any(map(lambda o: o == -1, rez)):
	print('NO')
else:
	print('YES')
	print(*rez)


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


n = int(input())
l = [int(s) for s in input().split()]
r = [int(s) for s in input().split()]
a = [0 for i in range(n)]

def check():
	for i in range(n):
		if l[i] > i or r[i] > n - 1 - i:
			print('NO', end='')
			return
		a[i] = l[i] + r[i]
	mx = max(a)
	if sum(a) > n * (n - 1) / 2:
		print('NO', end='')
		return
	b = [mx - a[i] + 1 for i in range(n)]
	for i in range(n):
		c = 0
		for j in range(i):
			if b[j] > b[i]:
				c += 1
		if c != l[i]:
			print('NO', end='')
			return
	for i in range(n - 1, -1, -1):
		c = 0
		for j in range(n - 1, i, -1):
			if b[j] > b[i]:
				c += 1
		if c != r[i]:
			print('NO', end='')
			return
	print('YES')
	for s in b:
		print(s, end=' ')
check()


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


import heapq

def read():
	return [int(v) for v in input().split()]

def main():
	n = read()[0]
	l = read()
	r = read()
	current = n
	last_popped = 0
	h = [(l + r, index) for (l, r, index) in zip(l, r, range(n))]
	heapq.heapify(h)
	result = [0] * n
	while h:
		t = heapq.heappop(h)
		if t[0] > last_popped:
			current -= 1
		result[t[1]] = current
		last_popped = t[0]
	(new_l, new_r) = ([], [])
	for i in range(n):
		new_l.append(len([k for k in result[:i] if k > result[i]]))
		new_r.append(len([k for k in result[i + 1:] if k > result[i]]))
	if new_l == l and new_r == r:
		print('YES')
		for i in range(n):
			print(result[i], end=' ')
	else:
		print('NO')
main()


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)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
ans = [1 for i in range(n)]
s = [l[i] + r[i] for i in range(n)]
order = [i for i in range(n)]
for i in range(n - 1):
	m = i
	for j in range(i + 1, n):
		if s[m] < s[j]:
			m = j
	t = s[i]
	s[i] = s[m]
	s[m] = t
	t = order[i]
	order[i] = order[m]
	order[m] = t
cur = 1
for i in range(1, n):
	if s[i - 1] > s[i]:
		cur += 1
	ans[order[i]] = cur
for i in range(n):
	k = 0
	for j in range(i):
		if ans[j] > ans[i]:
			k += 1
	if l[i] != k:
		print('NO')
		exit()
	k = 0
	for j in range(i + 1, n):
		if ans[j] > ans[i]:
			k += 1
	if r[i] != k:
		print('NO')
		exit()
print('YES')
for i in ans:
	print(i, end=' ')


n = int(input())
L = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]
E = []
otv = [0] * n
for i in range(n):
	sum_ = L[i] + R[i]
	E.append([sum_, i])
E.sort()
for i in range(n):
	x = R[i]
	for j in range(n):
		if x > 0:
			if E[j][1] > i:
				otv[E[j][1]] += 1
				x -= 1
		else:
			break
	if x > 0:
		print('NO')
		exit()
	x = L[i]
	for j in range(n):
		if x > 0:
			if E[j][1] < i:
				otv[E[j][1]] += 1
				x -= 1
		else:
			break
	if x > 0:
		print('NO')
		exit()
for i in range(n):
	r = 0
	l = 0
	for j in range(i + 1, n):
		if otv[j] > otv[i]:
			r += 1
	for z in range(i - 1, -1, -1):
		if otv[z] > otv[i]:
			l += 1
	if r != R[i] or l != L[i]:
		print('NO')
		exit()
print('YES')
for i in range(n):
	print(otv[i] + 1, end=' ')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
rank = [x + y for (x, y) in zip(l, r)]
max_rank = max(rank) + 1
ans = [max_rank - x for x in rank]
for i in range(n):
	c_l = 0
	for j in range(0, i):
		if ans[i] < ans[j]:
			c_l += 1
	if c_l != l[i]:
		print('NO')
		break
	c_r = 0
	for j in range(i + 1, n):
		if ans[i] < ans[j]:
			c_r += 1
	if c_r != r[i]:
		print('NO')
		break
else:
	print('YES')
	print(*ans)


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())
flag = True
(l, r) = (list(map(int, input().split())), list(map(int, input().split())))
(ans, check_l, check_r) = ([n for i in range(n)], [0 for i in range(n)], [0 for i in range(n)])
for i in range(n):
	ans[i] -= l[i] + r[i]
for i in range(n):
	(cl, cr) = (0, 0)
	for j in range(i):
		if ans[j] > ans[i]:
			cl += 1
	for j in range(i + 1, n):
		if ans[j] > ans[i]:
			cr += 1
	if cl != l[i] or cr != r[i]:
		flag = False
		break
mini = min(ans) - 1
for i in range(n):
	ans[i] -= mini
if flag:
	print('YES')
	for i in ans:
		print(i, end=' ')
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
maxx = 0
s = []
it = 0
for i in range(n):
	s.append(l[i] + r[i])
	if l[i] > i or r[i] > n - i - 1:
		it = 1
its = list(s)
while maxx < n:
	summ = 0
	ll = 0
	rr = its.count(-1)
	for i in range(n):
		if its[i] == -1:
			ll += 1
			rr -= 1
		if its[i] != -1 and i < n - 1 and (r[i] < rr):
			it = 1
			break
		if its[i] != -1 and i > 0 and (l[i] < ll):
			it = 1
			break
	if it == 1:
		break
	for i in range(n):
		if s[i] == maxx:
			s[i] = -maxx
			its[i] = -1
			summ += 1
	if summ == 0:
		it = 1
		break
	maxx += summ
if it == 1:
	print('NO')
else:
	print('YES')
	for i in s:
		print(i - min(s) + 1, end=' ')


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


import atexit, io, sys, collections, math, heapq, fractions, copy, os, functools
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 f(left, right, n):
	r = [-1 for _ in range(n)]
	seen = set([])
	elem = n
	while len(seen) < n:
		cur = set([])
		for i in range(n):
			if i not in seen:
				if left[i] == right[i] == 0:
					cur.add(i)
					seen.add(i)
		count = 0
		for i in range(n):
			if i in seen:
				if i in cur:
					count += 1
			else:
				left[i] -= count
				if left[i] < 0:
					print('NO')
					return
		count = 0
		for i in range(n)[::-1]:
			if i in seen:
				if i in cur:
					count += 1
			else:
				right[i] -= count
				if right[i] < 0:
					print('NO')
					return
		for i in cur:
			r[i] = elem
		elem -= 1
		if len(cur) == 0:
			break
	if min(r) < 0:
		print('NO')
		return
	print('YES')
	print(' '.join(map(str, r)))
n = int(input())
left = list(map(int, input().split()))
right = list(map(int, input().split()))
f(left, right, n)


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


import sys
amount = int(input())
first_inv = [int(s) for s in input().split()]
second_inv = [int(s) for s in input().split()]
array = [0] * len(second_inv)
for i in range(len(second_inv)):
	array[i] = second_inv[i] + first_inv[i]
max_ = max(array)
array = [max_ + 1] * len(second_inv)
for i in range(len(second_inv)):
	array[i] -= second_inv[i] + first_inv[i]
for i in range(len(second_inv)):
	counter = 0
	for j in range(len(array) - 1, i - 1, -1):
		if array[i] < array[j]:
			counter += 1
	if counter != second_inv[i]:
		print('NO')
		sys.exit(0)
for i in range(len(first_inv)):
	counter = 0
	for j in range(i):
		if array[i] < array[j]:
			counter += 1
	if counter != first_inv[i]:
		print('NO')
		sys.exit(0)
print('YES')
print(' '.join([str(s) for s in array]))


from collections import Counter

def main():
	n = int(input())
	L = [int(c) for c in input().split()]
	E = [int(c) for c in input().split()]
	pos = [l + r for (l, r) in zip(L, E)]
	for e in pos:
		if e >= n:
			print('NO')
			return
	prev = 0
	candies_pos = {}
	for (k, v) in sorted(Counter(pos).items(), key=lambda x: x[0]):
		if k == prev:
			prev += v
		else:
			print('NO')
			return
		candies_pos[k] = n
		n -= 1
	if prev == len(pos):
		res = [candies_pos[elm] for elm in pos]
		for (i, (l, r)) in enumerate(zip(L, E)):
			less = 0
			more = 0
			for (j, c) in enumerate(res):
				if res[j] > res[i]:
					if j < i:
						less += 1
					elif j > i:
						more += 1
			if less != l or more != r:
				print('NO')
				return
	else:
		print('NO')
	print('YES')
	print(' '.join([str(candies_pos[elm]) for elm in pos]))
main()


n = int(input())
l = [int(t) for t in input().split(' ')]
r = [int(t) for t in input().split(' ')]
a = [None] * n
maxcandy = n
while True:
	maxcount = 0
	for i in range(n):
		if a[i] is None and l[i] == 0 and (r[i] == 0):
			a[i] = maxcandy
			maxcount += 1
	if maxcount == 0:
		break
	restcount = maxcount
	for i in range(n):
		if a[i] is None:
			r[i] -= restcount
			l[i] -= maxcount - restcount
		elif a[i] == maxcandy:
			restcount -= 1
	maxcandy -= 1
if a.count(None) > 0:
	print('NO')
else:
	print('YES')
	print(' '.join((str(t) for t in a)))


from math import ceil, sqrt
t = 1
for test in range(1, t + 1):
	n = int(input())
	l = list(map(int, input().split()))
	r = list(map(int, input().split()))
	a = [0 for i in range(n)]
	ans = 'YES'
	cur = 0
	count = 0
	left = n
	for i in range(n):
		new = 0
		for j in range(n):
			if l[j] + r[j] == count:
				new += 1
				left -= 1
				a[j] = cur
		count += new
		cur -= 1
	minim = abs(min(a)) + 1
	for i in range(n):
		a[i] += abs(minim)
	for i in range(n):
		count1 = 0
		for j in range(i):
			if a[j] > a[i]:
				count1 += 1
		count2 = 0
		for j in range(i + 1, n):
			if a[j] > a[i]:
				count2 += 1
		if a[i] > n or count2 != r[i] or count1 != l[i]:
			ans = 'NO'
	if ans == 'NO':
		print(ans)
	else:
		print(ans)
		print(*a)


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)


from itertools import groupby
n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
sums = [(a + b, ind) for (ind, (a, b)) in enumerate(zip(l, r))]
sums.sort()
answer = [None] * n
curr_candies = n
for (key, group) in groupby(sums, key=lambda i: i[0]):
	for elem in group:
		answer[elem[1]] = curr_candies
	curr_candies -= 1
tl = []
for i in range(n):
	cnt = 0
	for j in range(i):
		if answer[j] > answer[i]:
			cnt += 1
	tl.append(cnt)
tr = []
for i in range(n):
	cnt = 0
	for j in range(i + 1, n):
		if answer[j] > answer[i]:
			cnt += 1
	tr.append(cnt)
if tl != l or tr != r:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, answer)))


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left
printHeap = str()
test = False
memory_constrained = False

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def test_print(output):
	if test:
		stdout.write(str(output) + '\n')

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

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

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result

def main():
	n = get_int()
	li = get_list()
	ri = get_list()
	sm = list()
	res = [0] * n
	for i in range(n):
		sm.append(li[i] + ri[i])
	curr = min(sm)
	real_element = n
	if curr != 0:
		print('NO')
		return
	while True:
		next_curr = 10000
		for (i, ele) in enumerate(sm):
			if ele == curr:
				res[i] = real_element
			if ele < next_curr and ele > curr:
				next_curr = ele
		if next_curr == 10000:
			break
		curr = next_curr
		real_element -= 1
	for (i, ele) in enumerate(res):
		(l, r) = (0, 0)
		for (j, ele2) in enumerate(res):
			if i == j:
				continue
			if ele < ele2:
				if i < j:
					r += 1
				else:
					l += 1
		if not (li[i] == l and ri[i] == r):
			print('NO')
			return
	print('YES')
	display_list(res)
cProfile.run('main()') if test else main()


import math
n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
x = []
for i in range(n):
	x.append([l[i], r[i], i, r[i] + l[i]])
x = sorted(x, key=lambda item: item[3])
arr = [0] * n
mm = 1000
for i in range(n):
	arr[x[i][2]] = mm
	ii = x[i][2]
	ll = 0
	rr = 0
	for j in range(ii):
		if arr[j] > arr[ii]:
			ll += 1
	for j in range(ii + 1, n):
		if arr[j] > arr[ii]:
			rr += 1
	mm = mm - max(abs(ll - l[ii]), abs(rr - r[ii]))
	arr[ii] = mm
f = 1
for i in range(n):
	ll = 0
	rr = 0
	for j in range(i):
		if arr[j] > arr[i]:
			ll += 1
	for j in range(i + 1, n):
		if arr[j] > arr[i]:
			rr += 1
	if ll != l[i] or rr != r[i]:
		f = 0
		break
if f == 1:
	print('YES')
	mi = min(arr)
	for i in arr:
		print(i - mi + 1, end=' ')
	print()
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
cost = [(l[i] + r[i], i) for i in range(n)]
cost.sort()
CANDIES = [None] * n
CANDIES[cost[0][1]] = n
candy = n
for i in range(1, n):
	if cost[i][0] == cost[i - 1][0]:
		CANDIES[cost[i][1]] = candy
	else:
		candy -= 1
		CANDIES[cost[i][1]] = candy
check = 1
for i in range(n):
	lc = 0
	rc = 0
	for j in range(i):
		if CANDIES[j] > CANDIES[i]:
			lc += 1
	for j in range(i + 1, n):
		if CANDIES[j] > CANDIES[i]:
			rc += 1
	if lc != l[i] or rc != r[i]:
		check = 0
if check == 1:
	print('YES')
	for c in CANDIES:
		print(c, end=' ')
else:
	print('NO')


n = int(input())
l = [int(s) for s in input().split()]
r = [int(s) for s in input().split()]
max = l[0] + r[0]
for i in range(n):
	if l[i] + r[i] > max:
		max = l[i] + r[i]
a = []
for i in range(n):
	a.append(max + 1 - l[i] - r[i])
ans = True
for i in range(n):
	li = 0
	ri = 0
	for j in range(n):
		if j < i and a[j] > a[i]:
			li += 1
		elif j > i and a[j] > a[i]:
			ri += 1
	if li != l[i] or ri != r[i]:
		ans = False
		break
if ans:
	print('YES')
	print(*a)
else:
	print('NO')


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)


def inint():
	return int(input())

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

def main():
	n = inint()
	l = inlist()
	r = inlist()
	for i in range(n):
		if l[i] > i - 0 or r[i] > n - 1 - i:
			print('NO')
			return
	ch = 0
	for i in range(n):
		if l[i] == 0 and r[i] == 0:
			ch = 1
			break
	if ch != 1:
		print('NO')
		return
	a = [0 for i in range(n)]
	for i in range(n):
		a[i] += -l[i] - r[i]
	m = min(a)
	m = m * -1 + 1
	a = [i + m for i in a]
	for i in range(n):
		ll = 0
		rr = 0
		for j in range(i + 1, n):
			if a[i] < a[j]:
				rr += 1
		if rr != r[i]:
			print('NO')
			return
		for j in range(0, i):
			if a[i] < a[j]:
				ll += 1
		if ll != l[i]:
			print('NO')
			return
	aa = [str(i) for i in a]
	print('YES\n', ' '.join(aa))
main()


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


import sys, string
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi, log2

def input():
	return sys.stdin.buffer.readline().decode('utf-8')
from bisect import bisect_left, bisect_right
from operator import add
MOD = int(1000000000.0) + 7
INF = float('inf')

def solve():
	n = int(input())
	l = [int(x) for x in input().split()]
	r = [int(x) for x in input().split()]
	ans = [0] * n
	for cur in range(n, 0, -1):
		lp = l[:]
		cnt = 0
		for i in range(n):
			if ans[i]:
				continue
			if not l[i] and (not r[i]):
				cnt += 1
			else:
				l[i] -= cnt
		cnt = 0
		for i in range(n - 1, -1, -1):
			if ans[i]:
				continue
			if not lp[i] and (not r[i]):
				cnt += 1
				ans[i] = cur
			else:
				r[i] -= cnt
	if 0 in ans or set(r) != set(l) != set([0]):
		print('NO')
	else:
		print('YES')
		print(*ans)
T = 1
for case in range(1, T + 1):
	ans = solve()


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


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
a = []
for i in range(n):
	c = 0
	for j in range(0, i):
		if l[j] == 0 and r[j] == 0:
			c += 1
	for j in range(i + 1, n):
		if l[j] == 0 and r[j] == 0:
			c += 1
	s = l[i] + r[i]
	if s == 0:
		a.append(n)
	elif c > 0:
		a.append(n - abs(c - s) - 1)
	else:
		a.append(n - abs(c - s))
lc = rc = pc = 0
for i in range(n):
	c = 0
	for j in range(0, i):
		if a[j] > a[i]:
			c += 1
	if c == l[i]:
		lc += 1
for i in range(n):
	c = 0
	for j in range(i + 1, n):
		if a[j] > a[i]:
			c += 1
	if c == r[i]:
		rc += 1
for i in a:
	if i > 0:
		pc += 1
if lc == n and rc == n and (pc == n):
	print('YES')
	print(' '.join(list(map(str, a))))
else:
	print('NO')


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)

def getIntList():
	return list(map(int, input().split()))
try:
	import numpy

	def dprint(*args, **kwargs):
		print(*args, **kwargs, file=sys.stderr)
	dprint('debug mode')
except Exception:

	def dprint(*args, **kwargs):
		pass
inId = 0
outId = 0
if inId > 0:
	dprint('use input', inId)
	sys.stdin = open('input' + str(inId) + '.txt', 'r')
if outId > 0:
	dprint('use output', outId)
	sys.stdout = open('stdout' + str(outId) + '.txt', 'w')
	atexit.register(lambda : sys.stdout.close())
(N,) = getIntList()
zl = getIntList()
zr = getIntList()
zt = [(zl[i] + zr[i], i) for i in range(N)]
zt.sort()
za = [0 for i in range(N)]
now = N
for i in range(N):
	if i > 0 and zt[i - 1][0] < zt[i][0]:
		now -= 1
	za[zt[i][1]] = now
for i in range(N):
	l = 0
	r = 0
	for j in range(i):
		if za[j] > za[i]:
			l += 1
	for j in range(i + 1, N):
		if za[j] > za[i]:
			r += 1
	if zl[i] != l or zr[i] != r:
		print('NO')
		sys.exit()
print('YES')
for i in range(N):
	print(za[i], end=' ')


n = int(input())
l = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
ans = list(range(n))
total_found = 0
pom = 0
while total_found != n:
	found = False
	found_this_turn = 0
	all_found = 0
	for i in range(n):
		if l[i] == 0 and r[i] == 0:
			found = True
			total_found = total_found + 1
			all_found = all_found + 1
			ans[i] = n - pom
	for i in range(n):
		add = 0
		if l[i] == 0 and r[i] == 0:
			found_this_turn = found_this_turn + 1
			all_found = all_found - 1
			add = 1
		l[i] = l[i] - found_this_turn
		r[i] = r[i] - all_found - add
	if found == False:
		break
	pom = pom + 1
if total_found == n:
	print('YES')
	for v in ans:
		print(v)
else:
	print('NO')


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 collections import defaultdict

def f(l, r):
	cnts = defaultdict(list)
	lmax = [0] * len(l)
	rmax = [0] * len(l)
	for i in range(len(l)):
		cnts[l[i] + r[i]].append(i)
	mx = len(l)
	ans = [0] * len(l)
	for i in sorted(cnts):
		for ind in cnts[i]:
			if lmax[ind] == l[ind] and rmax[ind] == r[ind]:
				ans[ind] = mx
			else:
				return 'NO'
		for ind in cnts[i]:
			for j in range(0, ind):
				rmax[j] += 1
			for j in range(len(l) - 1, ind, -1):
				lmax[j] += 1
		mx -= 1
	print('YES')
	print(*ans)
	return ''
n = input()
l = list(map(int, input().strip().split()))
r = list(map(int, input().strip().split()))
print(f(l, r))


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


def get_input_list():
	return list(map(int, input().split()))
n = int(input())
l = get_input_list()
r = get_input_list()
a = [0 for _ in range(n)]
m = []
m_ = []
for i in range(n):
	m.append(l[i] + r[i])
	m_.append(l[i] + r[i])
m.sort()
ma = m[-1] + 1
for i in range(n):
	a[i] = ma - m_[i]
l_ = []
r_ = []
for i in range(n):
	c = 0
	d = 0
	for j in range(i + 1):
		if a[j] > a[i]:
			c += 1
	for j in range(i, n):
		if a[j] > a[i]:
			d += 1
	l_.append(c)
	r_.append(d)
res = True
for i in range(n):
	if l[i] != l_[i] or r[i] != r_[i]:
		res = False
		break
if res:
	print('YES')
	for i in range(n):
		a[i] = str(a[i])
	print(' '.join(a))
else:
	print('NO')


n = int(input())
l = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
a = [-1] * n
cl = [0] * n
cr = [0] * n
f = 0
k = n
fos = True
ttu = []
while fos and f < n:
	fos = False
	for i in range(n):
		if a[i] != -1:
			continue
		if l[i] == cl[i] and r[i] == cr[i]:
			a[i] = k
			ttu.append(i)
			f += 1
			fos = True
	ntu = True
	for i in range(n):
		if i in ttu:
			ntu = True
			continue
		if a[i] != -1:
			continue
		if ntu:
			tdcl = len([x for x in ttu if x < i])
			tdcr = len([x for x in ttu if x > i])
			ntu = False
		cl[i] += tdcl
		cr[i] += tdcr
	ttu = []
	k -= 1
if f != n:
	print('NO')
else:
	print('YES')
	print(*a, sep=' ')


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


n = int(input())
ll = list(map(int, input().split()))
lr = list(map(int, input().split()))
sm = []
ans = [0] * n
for i in range(n):
	sm.append([ll[i] + lr[i], i])
sm.sort()
val = n
f = True
curr = sm[0][0]
for i in range(n):
	if sm[i][0] == curr:
		ans[sm[i][1]] = val
	else:
		val -= 1
		ans[sm[i][1]] = val
		curr = sm[i][0]
for i in range(n):
	cnt1 = 0
	cnt2 = 0
	for j in range(i):
		cnt1 += int(ans[j] > ans[i])
	for j in range(i + 1, n):
		cnt2 += int(ans[j] > ans[i])
	if cnt1 != ll[i]:
		f = False
		break
	if cnt2 != lr[i]:
		f = False
		break
if f:
	print('YES')
	print(*ans)
else:
	print('NO')


import collections

def main():
	n = int(input())
	left = list(map(int, input().split()))
	right = list(map(int, input().split()))
	res = [0] * n
	val = n
	if all((not left[i] and (not right[i]) for i in range(n))):
		print('YES')
		print(' '.join(['1'] * n))
		return
	while not all((not left[i] and (not right[i]) for i in range(n))):
		zeroSet = set()
		for i in range(n):
			if not left[i] and (not right[i]) and (res[i] == 0):
				zeroSet.add(i)
				res[i] = val
		for v in zeroSet:
			for i in range(v + 1, n):
				if i not in zeroSet and res[i] == 0:
					left[i] -= 1
			for i in range(v):
				if i not in zeroSet and res[i] == 0:
					right[i] -= 1
		val -= 1
		if not zeroSet:
			print('NO')
			return
	for i in range(n):
		if not res[i]:
			res[i] = str(val)
		else:
			res[i] = str(res[i])
	if any((i == '0' for i in res)):
		print('NO')
		return
	print('YES')
	print(' '.join(res))
main()


def main():

	def update(l, r, i, res):
		j = 0
		while j < i:
			if res[j] is None:
				r[j] -= 1
				if r[j] < 0:
					return False
			j += 1
		j += 1
		while j < n:
			if res[j] is None:
				l[j] -= 1
				if l[j] < 0:
					return False
			j += 1
		return True
	ilist = {1}
	n = int(input())
	res = [None] * n
	cur = n
	l = [int(x) for x in input().split()]
	r = [int(x) for x in input().split()]
	while ilist and (sum(l) != 0 or sum(r) != 0):
		ilist = set()
		for i in range(n):
			if l[i] == r[i] == 0 and res[i] is None:
				res[i] = cur
				ilist.add(i)
		for i in ilist:
			check = update(l, r, i, res)
			if not check:
				return False
		cur -= 1
	if not ilist:
		return False
	for i in range(n):
		if res[i] is None:
			res[i] = cur
	return res
res = main()
if not res:
	print('NO')
else:
	print('YES')
	for x in res:
		print(x, end=' ')


def isValid(Ans, L, R):
	(l, r) = ([], [])
	for i in range(len(Ans)):
		(tl, tr) = (0, 0)
		for j in range(i):
			if Ans[i] < Ans[j]:
				tl += 1
		if tl != L[i]:
			return False
		for j in range(i + 1, len(Ans)):
			if Ans[i] < Ans[j]:
				tr += 1
		if tr != R[i]:
			return False
	return True
N = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
flag = True
ch = []
maxC = set()
for i in range(N):
	ch.append([i, l[i] + r[i]])
	maxC.add(l[i] + r[i])
maxC = len(maxC)
ch.sort(key=lambda x: x[1])
ans = [1] * N
cur = 0
i = 0
can = 1
while i < N:
	if ch[i][1] != cur:
		flag = False
		break
	t = 0
	while ch[i][1] == cur:
		ans[ch[i][0]] = can
		t += 1
		i += 1
		if i == N:
			break
	cur += t
	can += 1
if flag == False:
	print('NO')
else:
	gap = max(ans) + 1
	for i in range(len(ans)):
		ans[i] = gap - ans[i]
	if isValid(ans, l, r) == False:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(i, end=' ')


n = int(input())
arr1 = list(map(int, input().split()))
arr2 = list(map(int, input().split()))
farr = []
flag = 0
for i in range(n):
	if arr1[i] > i:
		flag = 1
	if arr2[i] > n - i - 1:
		flag = 1
	sumx = arr1[i] + arr2[i]
	farr.append((sumx, i))
farr.sort()
ansarr = [0] * n
temparr = [0] * n
rank = 0
simcount = 0
for i in range(n):
	if i == 0:
		if farr[i][0] != 0:
			flag = 1
			break
		else:
			ansarr[farr[i][1]] = n
			simcount += 1
			temparr[farr[i][1]] = 1
	elif farr[i][0] == farr[i - 1][0]:
		if sum(temparr[:farr[i][1]]) != arr1[farr[i][1]] + simcount or sum(temparr[farr[i][1]:]) != arr2[farr[i][1]]:
			flag = 1
			break
		else:
			simcount += 1
			temparr[farr[i][1]] = 1
			ansarr[farr[i][1]] = ansarr[farr[i - 1][1]]
	elif farr[i][0] != rank:
		flag = 1
		break
	elif farr[i - 1][0] < farr[i][0]:
		if sum(temparr[:farr[i][1]]) != arr1[farr[i][1]] or sum(temparr[farr[i][1]:]) != arr2[farr[i][1]]:
			flag = 1
			break
		else:
			ansarr[farr[i][1]] = ansarr[farr[i - 1][1]] - 1
			temparr[farr[i][1]] = 1
			simcount = 1
	rank += 1
if flag == 1:
	print('NO')
else:
	print('YES')
	print(*ansarr)


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


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


import bisect

def find(r_list, l_list):
	result_list = [-(r + l) for (r, l) in zip(r_list, l_list)]
	min_value = -min(result_list)
	return [result + min_value + 1 for result in result_list]

def validate(r_list, l_list, result_list):
	buffer = []
	for (l, item) in zip(l_list, result_list):
		index = bisect.bisect_right(buffer, item)
		if len(buffer) - index != l:
			return False
		buffer.insert(index, item)
	for (r, item) in zip(r_list, result_list):
		index = bisect.bisect_right(buffer, item)
		if len(buffer) - index != r:
			return False
		del buffer[index - 1]
	return True

def run():
	n = int(input())
	l = list(map(int, input().split()))
	r = list(map(int, input().split()))
	result = find(r, l)
	is_ok = validate(r, l, result)
	if is_ok:
		print('YES')
		print(*result)
	else:
		print('NO')
run()


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)


n = int(input())
l = list(map(int, input().split()))
r = list(map(int, input().split()))
s = []
m = 0
for i in range(len(r)):
	su = l[i] + r[i]
	if su > m:
		m = su
	s.append(-su)
a = list(map(lambda i: i + m + 1, s))
for i in range(len(a)):
	l1 = 0
	r1 = 0
	for j in range(i):
		if a[j] > a[i]:
			l1 += 1
	for j in range(i, len(a)):
		if a[j] > a[i]:
			r1 += 1
	if l1 != l[i] or r1 != r[i]:
		print('NO')
		exit()
print('YES')
print(' '.join(map(str, a)))


from sys import stdin, stdout

def check_2(arr, left, right, n):
	for i in range(n):
		lcount = 0
		rcount = 0
		for j in range(0, i):
			if arr[j] > arr[i]:
				lcount += 1
		if lcount != left[i]:
			print('NO')
			return False
		for j in range(i + 1, n):
			if arr[j] > arr[i]:
				rcount += 1
		if rcount != right[i]:
			print('NO')
			return False
	return True

def myfunction(arr, left, right, n):
	for i in range(n):
		if left[i] <= i and right[i] < n - i:
			arr[i] += -(left[i] + right[i])
		else:
			print('NO')
			return False
	return True
n = int(stdin.readline().strip())
left = list(map(int, stdin.readline().split()))
right = list(map(int, stdin.readline().split()))
arr = [0] * n
if myfunction(arr, left, right, n):
	MIN = arr[0]
	for i in range(1, n):
		MIN = min(arr[i], MIN)
	MIN = -1 * MIN
	for i in range(n):
		arr[i] = arr[i] + MIN + 1
	if check_2(arr, left, right, n):
		print('YES')
		for i in range(n):
			print(arr[i], end=' ')


n = int(input())
l = list(map(int, input().strip().split()))
r = list(map(int, input().strip().split()))
a = [(l[i] + r[i], i) for i in range(n)]
a.sort(reverse=True)
(k, ans, pre) = (0, True, n)
arr = [0] * n
for i in range(n):
	if a[i][0] >= n:
		ans = False
		break
	if pre == a[i][0]:
		arr[a[i][1]] = k
	else:
		k += 1
		arr[a[i][1]] = k
	pre = a[i][0]
for i in range(n):
	for j in range(i):
		if arr[j] > arr[i]:
			l[i] -= 1
	for j in range(i + 1, n):
		if arr[j] > arr[i]:
			r[i] -= 1
	if l[i] != 0 or r[i] != 0:
		ans = False
		break
if ans:
	print('YES')
	print(*arr)
else:
	print('NO')


n = int(input())
l = [int(i) for i in input().split()]
r = [int(i) for i in input().split()]
items = [(-l[i] - r[i], i) for i in range(n)]
items.sort()
vals = [1] * n
m = 1
for i in range(1, n):
	if items[i - 1][0] != items[i][0]:
		m += 1
	vals[items[i][1]] = m
for i in range(n):
	ln = sum(map(lambda x: x - vals[i] > 0, vals[:i]))
	lr = sum(map(lambda x: x - vals[i] > 0, vals[i:]))
	if ln != l[i] or lr != r[i]:
		print('NO')
		break
else:
	print('YES')
	print(' '.join((str(i) for i in vals)))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [0] * n
for i in range(n):
	c[i] = a[i] + b[i]
c = list(set(c))
c.sort()
d = dict()
for i in range(len(c)):
	d[c[i]] = 0
k = 1
for i in range(len(c) - 1, -1, -1):
	d[c[i]] = k
	k += 1
ans = [0] * n
for i in range(n):
	ans[i] = d[a[i] + b[i]]
for i in range(n):
	r = a[i]
	l = b[i]
	num = 0
	for j in range(i + 1, n):
		if ans[j] > ans[i]:
			num += 1
	num2 = 0
	for j in range(0, i):
		if ans[j] > ans[i]:
			num2 += 1
	if num != l or num2 != r:
		print('NO')
		exit()
print('YES')
print(*ans)


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


from sys import stdin
YES = 'YES'
NO = 'NO'
nbr_kids = int(stdin.readline().strip())
l = tuple(map(int, stdin.readline().strip().split()))
r = tuple(map(int, stdin.readline().strip().split()))

def make_lr(arr):
	L = list()
	R = list()
	for (idx, n) in enumerate(arr):
		R.append(sum((1 for a in arr[idx + 1:] if a > n)))
	R = tuple(R)
	rev_arr = list(reversed(arr))
	for (idx, n) in enumerate(rev_arr):
		L.append(sum((1 for a in rev_arr[idx + 1:] if a > n)))
	L = tuple(reversed(L))
	return (L, R)

def solve():
	if l[0] != 0 or r[-1] != 0:
		return NO
	together = [a + b for (a, b) in zip(l, r)]
	if sum(together) == 0:
		return (YES, [1] * len(r))
	sol = [nbr_kids - a for a in together]
	(myl, myr) = make_lr(sol)
	if myl == l and myr == r:
		return (YES, sol)
	else:
		return NO
(yn, answ) = solve()
if yn == YES:
	print(YES)
	print(' '.join(map(str, answ)))
else:
	print(NO)


import sys
n = int(input())
L = list(map(int, input().split()))
R = list(map(int, input().split()))
candie = [0] * n
count = 0
now_candie = n
while 1:
	if count == n:
		break
	tmp = []
	for i in range(n):
		if L[i] == 0 and R[i] == 0:
			tmp.append(i)
	if len(tmp) == 0:
		print('NO')
		sys.exit()
	for child in tmp:
		candie[child] = now_candie
		L[child] = n + 1
		R[child] = n + 1
		count += 1
	for child in tmp:
		for i in range(child):
			R[i] -= 1
			if R[i] < 0:
				print('NO')
				sys.exit()
		for i in range(n - 1, child, -1):
			L[i] -= 1
			if L[i] < 0:
				print('NO')
				sys.exit()
	now_candie -= 1
print('YES')
print(' '.join(list(map(str, candie))))


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


n = int(input())
ls = list(map(int, input().split()))
rs = list(map(int, input().split()))
sums = []
maxx = 0
for i in range(len(rs)):
	summ = ls[i] + rs[i]
	if summ > maxx:
		maxx = summ
	sums.append(-summ)
ans = list(map(lambda i: i + maxx + 1, sums))
for i in range(len(ans)):
	l = 0
	r = 0
	for j in range(i):
		if ans[j] > ans[i]:
			l += 1
	for j in range(i, len(ans)):
		if ans[j] > ans[i]:
			r += 1
	if l != ls[i] or r != rs[i]:
		print('NO')
		exit()
print('YES')
print(' '.join(map(str, ans)))


n = int(input())
L = list(map(int, input().split(' ')))
R = list(map(int, input().split(' ')))
LR = list(zip(L, R))
index_to_candies = {}
candy = n
for nn in range(n, 0, -1):
	if len(index_to_candies) == n:
		break
	zero_index = []
	for (idx, (l, r)) in enumerate(LR):
		if (l, r) == (0, 0) and (not idx in index_to_candies):
			index_to_candies[idx] = nn
			zero_index.append(idx)
	if len(zero_index) == 0:
		print('NO')
		exit()
	dec_left = 0
	dec_right = len(zero_index)
	zero_index_idx = 0
	for (idx, (l, r)) in enumerate(LR):
		if zero_index_idx < len(zero_index) and zero_index[zero_index_idx] == idx:
			zero_index_idx += 1
			dec_left += 1
			dec_right -= 1
		if (l, r) != (0, 0):
			LR[idx] = (l - dec_left, r - dec_right)
			if LR[idx][0] < 0 or LR[idx][1] < 0:
				print('NO')
				exit()
print('YES')
j = []
for i in range(n):
	j.append(str(index_to_candies[i]))
print(' '.join(j))


n = input()
n = int(n)
l = input()
r = input()
l = list(l.split(' '))
r = list(r.split(' '))
for i in range(n):
	l[i] = int(l[i])
	r[i] = int(r[i])
arr = [0] * n
vis = [0] * n
k = n
while 1 == 1:
	v = []
	for i in range(n):
		if vis[i] == 0 and l[i] == 0 and (r[i] == 0):
			v.append(i)
			vis[i] = 1
	if len(v) == 0:
		break
	for x in v:
		for i in range(n):
			if vis[i] == 0:
				if i < x:
					r[i] -= 1
				elif x < i:
					l[i] -= 1
		arr[x] = k
	k -= 1
for x in arr:
	if x == 0:
		print('NO')
		exit()
print('YES')
for x in arr:
	print(x, 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('')