It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in order of their difficulty. Unfortunately, some tasks can have the same difficulty, so the order in which one can perform the tasks may vary.

Menshykov, Uslada and Horace ask you to deal with this nuisance and come up with individual plans for each of them. The plan is a sequence describing the order in which an animal should do all the n tasks. Besides, each of them wants to have its own unique plan. Therefore three plans must form three different sequences. You are to find the required plans, or otherwise deliver the sad news to them by stating that it is impossible to come up with three distinct plans for the given tasks.

Input

The first line contains integer n (1 ≤ n ≤ 2000) — the number of tasks. The second line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 2000), where hi is the difficulty of the i-th task. The larger number hi is, the more difficult the i-th task is.

Output

In the first line print "YES" (without the quotes), if it is possible to come up with three distinct plans of doing the tasks. Otherwise print in the first line "NO" (without the quotes). If three desired plans do exist, print in the second line n distinct integers that represent the numbers of the tasks in the order they are done according to the first plan. In the third and fourth line print two remaining plans in the same form.

If there are multiple possible answers, you can print any of them.

Examples

Input

4
1 3 3 1


Output

YES
1 4 2 3 
4 1 2 3 
4 1 3 2 


Input

5
2 4 1 4 8


Output

NO

Note

In the first sample the difficulty of the tasks sets one limit: tasks 1 and 4 must be done before tasks 2 and 3. That gives the total of four possible sequences of doing tasks : [1, 4, 2, 3], [4, 1, 2, 3], [1, 4, 3, 2], [4, 1, 3, 2]. You can print any three of them in the answer.

In the second sample there are only two sequences of tasks that meet the conditions — [3, 1, 2, 4, 5] and [3, 1, 4, 2, 5]. Consequently, it is impossible to make three distinct sequences of tasks.

Difficulty: EASY
Tags: Sorting

Implementation
Skill types: Sorting

Starter code:

Solutions:
n = int(input())
ar = [int(i) for i in input().split()]
new = sorted(((ar[i], i + 1) for i in range(n)))
res = [new[i][1] for i in range(n)]
swap = []
for i in range(n - 1):
	if new[i][0] == new[i + 1][0]:
		swap.append((i, i + 1))
		if len(swap) == 2:
			print('YES')
			print(' '.join((str(i) for i in res)))
			for (j, k) in swap:
				(res[j], res[k]) = (res[k], res[j])
				print(' '.join((str(i) for i in res)))
			quit()
print('NO')


n = int(input())
tasks = list(map(int, input().split()))
p = []
for i in range(n):
	p.append((i + 1, tasks[i]))
p.sort(key=lambda x: x[1])
l1 = p.copy()
l2 = []
l3 = []
count = 0
for i in range(1, n):
	if p[i][1] == p[i - 1][1]:
		count += 1
		if count > 1:
			break
if count < 2:
	print('NO')
else:
	print('YES')
	for i in range(1, n):
		if p[i][1] == p[i - 1][1]:
			(p[i], p[i - 1]) = (p[i - 1], p[i])
			if l2 == []:
				l2 = p.copy()
			else:
				l3 = p.copy()
				break
	for i in range(n):
		print(l1[i][0], end=' ')
	print()
	for i in range(n):
		print(l2[i][0], end=' ')
	print()
	for i in range(n):
		print(l3[i][0], end=' ')


def solve(nums):
	nums = zip(nums, [i + 1 for i in range(len(nums))])
	nums = sorted(nums, key=lambda x: x[0])
	seqs = [[], [], []]
	prev = nums[0][0]
	count = 0
	for (n, i) in nums[1:]:
		if n == prev:
			count += 1
		prev = n
	if count < 2:
		print('NO')
		return
	print('YES')
	curr = 0
	prev = None
	for (n, i) in nums:
		seqs[0].append(i)
		seqs[1].append(i)
		seqs[2].append(i)
		if not (n != prev or curr >= 2):
			(seqs[curr + 1][-1], seqs[curr + 1][-2]) = (seqs[curr + 1][-2], seqs[curr + 1][-1])
			curr += 1
		prev = n
	for s in seqs:
		print(' '.join(map(str, s)))
input()
solve(list(map(int, input().split(' '))))


class Task:

	def __init__(self, value, index):
		self.value = value
		self.index = index

	def __lt__(self, other):
		return self.value < other.value

def swap(a, start, end):
	tmp = a[start].value
	a[start].value = a[end].value
	a[end].value = tmp
	tmp = a[start].index
	a[start].index = a[end].index
	a[end].index = tmp
N = int(input())
A = map(int, input().split())
a = []
for (index, value) in enumerate(A):
	a.append(Task(value, index + 1))
a = sorted(a)
i = 0
firstStart = -1
firstEnd = -1
secondStart = -1
secondEnd = -1
while i < len(a) - 1:
	if firstStart == -1 and a[i].value == a[i + 1].value:
		firstStart = i
		while i < len(a) - 1 and a[i].value == a[i + 1].value:
			i += 1
		firstEnd = i
	elif secondStart == -1 and a[i].value == a[i + 1].value:
		secondStart = i
		while i < len(a) - 1 and a[i].value == a[i + 1].value:
			i += 1
		secondEnd = i
	i += 1
if firstStart == -1 or (firstEnd - firstStart <= 1 and secondStart == -1):
	print('NO')
else:
	print('YES')
	print(' '.join([str(x.index) for x in a]))
	swap(a, firstStart, firstEnd)
	print(' '.join([str(x.index) for x in a]))
	if firstEnd - firstStart >= 2:
		swap(a, firstStart, firstStart + 1)
	else:
		swap(a, secondStart, secondEnd)
	print(' '.join([str(x.index) for x in a]))


from random import shuffle

def main():
	n = int(input())
	a = sorted([(x, i + 1) for (i, x) in enumerate(map(int, input().split()))])
	ways = 1
	i = 0
	parts = []
	while i < n:
		j = i
		while j < n and a[j][0] == a[i][0]:
			j += 1
		parts.append(a[i:j])
		ways = min(ways * (j - i), 3)
		i = j
	if ways < 3:
		print('NO')
		return
	print('YES')
	outp = set()
	for _ in range(3):
		while True:
			cur = []
			for x in parts:
				shuffle(x)
				cur.extend([t[1] for t in x])
			if tuple(cur) not in outp:
				print(' '.join(map(str, cur)))
				outp.add(tuple(cur))
				break
main()


n = int(input())
a = list(map(int, input().split()))
if n < 3:
	print('NO')
else:
	for i in range(n):
		a[i] = [a[i], i]
	a.sort()
	b = [[0, []] for i in range(2001)]
	p = 0
	k = [0, 0]
	for i in range(n):
		b[a[i][0]][0] += 1
		b[a[i][0]][1].append(i)
		if b[a[i][0]][0] == 3:
			p = 1
			print('YES')
			break
		elif k[0] != 0 and b[a[i][0]][0] == 2:
			k[1] = a[i][0]
			p = 2
			print('YES')
			break
		elif b[a[i][0]][0] == 2:
			k[0] = a[i][0]
	if p == 0:
		print('NO')
	else:
		j = i
		if p == 1:
			for i in range(n):
				print(a[i][1] + 1, end=' ')
			(a[b[a[j][0]][1][0]][1], a[b[a[j][0]][1][1]][1]) = (a[b[a[j][0]][1][1]][1], a[b[a[j][0]][1][0]][1])
			print()
			for i in range(n):
				print(a[i][1] + 1, end=' ')
			(a[b[a[j][0]][1][0]][1], a[b[a[j][0]][1][2]][1]) = (a[b[a[j][0]][1][2]][1], a[b[a[j][0]][1][0]][1])
			print()
			for i in range(n):
				print(a[i][1] + 1, end=' ')
		else:
			for i in range(n):
				print(a[i][1] + 1, end=' ')
			(a[b[k[0]][1][0]][1], a[b[k[0]][1][1]][1]) = (a[b[k[0]][1][1]][1], a[b[k[0]][1][0]][1])
			print()
			for i in range(n):
				print(a[i][1] + 1, end=' ')
			(a[b[k[1]][1][0]][1], a[b[k[1]][1][1]][1]) = (a[b[k[1]][1][1]][1], a[b[k[1]][1][0]][1])
			print()
			for i in range(n):
				print(a[i][1] + 1, end=' ')


n = int(input())
x = list(map(int, input().split()))
if n >= len(set(x)) + 2:
	print('YES')
	y = []
	for i in range(n):
		y.append([x[i], i + 1])
	y.sort()
	y.sort(key=lambda i: i[0])
	for i in range(n):
		print(y[i][1], end=' ')
	ind = 1
	print('')
	for i in range(1, n):
		if y[i][0] == y[i - 1][0]:
			(y[i], y[i - 1]) = (y[i - 1], y[i])
			ind = i + 1
			break
	for i in range(n):
		print(y[i][1], end=' ')
	print('')
	for i in range(ind, n):
		if y[i][0] == y[i - 1][0]:
			(y[i], y[i - 1]) = (y[i - 1], y[i])
	for i in range(n):
		print(y[i][1], end=' ')
	print('')
else:
	print('NO')


n = int(input())
h = list(map(int, input().split()))
S = sorted([(h[i], i) for i in range(n)])
A = [S[i][1] for i in range(n)]
swp = [(0, 0)]
for i in range(n - 1):
	if S[i][0] == S[i + 1][0]:
		swp.append((i, i + 1))
		if len(swp) == 3:
			print('YES')
			for (i, j) in swp:
				(A[i], A[j]) = (A[j], A[i])
				print(' '.join((repr(a + 1) for a in A)))
			exit()
print('NO')


a = int(input())
b = [[] for _ in ' ' * 2001]
ok2 = 0
ok3 = 0
(k5, k6, k7) = (0, 1, 1)
for (i, j) in enumerate(map(int, input().split())):
	b[j].append(i + 1)
k = [[] for _ in ' ' * 3]
for i in range(2001):
	if len(b[i]):
		if len(b[i]) > 2:
			ok3 = 1
			(k2, k3, k4) = (0, 1, 2)
			for j in range(len(b[i])):
				k[0].append(b[i][(j + k2) % len(b[i])])
				k[1].append(b[i][(j + k3) % len(b[i])])
				k[2].append(b[i][(j + k4) % len(b[i])])
		elif len(b[i]) == 2:
			ok2 += 1
			for j in range(len(b[i])):
				k[0].append(b[i][(j + k5) % len(b[i])])
				k[1].append(b[i][(j + k6) % len(b[i])])
				k[2].append(b[i][(j + k7) % len(b[i])])
			(k5, k6, k7) = (1, 1, 0)
		else:
			k[0].append(b[i][0])
			k[1].append(b[i][0])
			k[2].append(b[i][0])
if ok3 or ok2 > 1:
	print('YES')
	for i in k:
		print(*i)
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
q = []
w = []
r = [0]
for i in range(n):
	q.append([l[i], i + 1])
q = sorted(q)
for j in range(1, n):
	if q[j][0] == q[j - 1][0]:
		r[0] += 1
		r.append(j + 1)
	if r[0] == 2:
		break
for i in q:
	w.append(i[1])
if r[0] == 2:
	print('YES')
	print(*w)
	for k in range(1, 3):
		(w[r[k] - 1], w[r[k] - 2]) = (w[r[k] - 2], w[r[k] - 1])
		print(*w)
else:
	print('NO')


import sys
sys.setrecursionlimit(100000)
INF = int(10000000.0 + 1)
MAX = 100005

class Pair:

	def __init__(self, a, b):
		self.first = a
		self.second = b

	def __lt__(self, other):
		return self.first < other.first or (self.first == other.first and self.second < other.second)

class Edge:

	def __init__(self, u, v, w):
		self.u = u
		self.v = v
		self.w = w

	def __lt__(self, other):
		return self.w < other.w

def init():
	pass

def erase(string):
	return string[1:]

def main():
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		a[i] = Pair(a[i], i + 1)
	a.sort()
	countPair = 0
	for i in range(n - 1):
		if a[i].first == a[i + 1].first:
			countPair += 1
	if countPair < 2:
		print('NO')
	else:
		print('YES')
		count = 0
		for i in range(n - 1):
			if a[i].first == a[i + 1].first:
				for j in range(n):
					print(a[j].second, end=' ')
				print()
				count += 1
				(a[i].second, a[i + 1].second) = (a[i + 1].second, a[i].second)
				if count == 2:
					for j in range(n):
						print(a[j].second, end=' ')
					break
main()


def main():
	n = int(input())
	h = list(map(int, input().split()))
	h = [[h[i], i + 1] for i in range(n)]
	h = sorted(h, key=lambda x: x[0])
	combination = 1
	count = 1
	flag = False
	for i in range(1, n):
		if h[i][0] == h[i - 1][0]:
			count += 1
		else:
			combination *= count
			count = 1
	if combination * count >= 3:
		flag = True
	if not flag:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			print(h[i][1], end=' ')
		print()
		position = 0
		for i in range(1, n):
			if h[i][0] == h[i - 1][0]:
				(h[i], h[i - 1]) = (h[i - 1], h[i])
				position = i
				break
		for i in range(n):
			print(h[i][1], end=' ')
		print()
		for i in range(position + 1, n):
			if h[i][0] == h[i - 1][0]:
				(h[i], h[i - 1]) = (h[i - 1], h[i])
				break
		for i in range(n):
			print(h[i][1], end=' ')
main()


n = int(input())
lis = input().split()
for i in range(n):
	lis[i] = int(lis[i])
lis1 = sorted(list(set(lis)))
dic = {}
for k in lis1:
	dic[k] = []
for i in range(n):
	for j in range(len(lis1)):
		if lis1[j] == lis[i]:
			dic[lis1[j]].append(i + 1)
dic1 = {}
for [u, v] in dic.items():
	if len(v) >= 2:
		dic1[u] = v
if len(dic1) == 0:
	print('NO')
if len(dic1) == 1:
	for [u, v] in dic1.items():
		if len(v) < 3:
			print('NO')
		else:
			print('YES')
			for i in range(len(lis1)):
				for k in dic[lis1[i]]:
					print(k, end=' ')
			print()
			for i in range(len(lis1)):
				if lis1[i] in dic1.keys():
					print(dic1[lis1[i]][1], end=' ')
					print(dic1[lis1[i]][0], end=' ')
					for k in dic[lis1[i]][2:]:
						print(k, end=' ')
				else:
					for k in dic[lis1[i]]:
						print(k, end=' ')
			print()
			for i in range(len(lis1)):
				if lis1[i] in dic1.keys():
					print(dic1[lis1[i]][2], end=' ')
					for k in dic[lis1[i]][:2] + dic[lis1[i]][3:]:
						print(k, end=' ')
				else:
					for k in dic[lis1[i]]:
						print(k, end=' ')
if len(dic1) >= 2:
	print('YES')
	lis2 = []
	for k in dic1.keys():
		lis2.append(k)
	index1 = lis1.index(lis2[0])
	index2 = lis1.index(lis2[1])
	for i in range(len(lis1)):
		for k in dic[lis1[i]]:
			print(k, end=' ')
	print()
	for i in range(len(lis1)):
		if i != index1:
			for k in dic[lis1[i]]:
				print(k, end=' ')
		else:
			(dic[lis1[i]][0], dic[lis1[i]][1]) = (dic[lis1[i]][1], dic[lis1[i]][0])
			for k in dic[lis1[i]]:
				print(k, end=' ')
	print()
	for i in range(len(lis1)):
		if i != index2:
			for k in dic[lis1[i]]:
				print(k, end=' ')
		else:
			(dic[lis1[i]][0], dic[lis1[i]][1]) = (dic[lis1[i]][1], dic[lis1[i]][0])
			for k in dic[lis1[i]]:
				print(k, end=' ')
	print()


n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
	if d.get(a[i]):
		d[a[i]].append(i + 1)
	else:
		d[a[i]] = [i + 1]
k = 1
for i in sorted(d.keys()):
	k *= len(d[i])
if k < 3:
	print('NO')
else:
	print('YES')
	for i in sorted(d.keys()):
		print(' '.join(map(str, d[i])), end=' ')
	print()
	for i in sorted(d.keys()):
		print(' '.join(map(str, d[i][::-1])), end=' ')
	print()
	first = True
	for i in sorted(d.keys()):
		if first and len(d[i]) >= 2:
			print(' '.join(map(str, d[i][1:len(d[i])] + [d[i][0]])), end=' ')
			first = False
		else:
			print(' '.join(map(str, d[i])), end=' ')


from collections import Counter
n = int(input())
l = list(map(int, input().split()))
d = Counter(l)
no_ln = 0
ok = 0
for t in d:
	if d[t] >= 3:
		ok = 1
		break
	if d[t] == 2:
		no_ln += 1
		if no_ln == 2:
			ok = 1
			break
if ok == 0:
	print('NO')
else:
	print('YES')
	idx1 = {}
	idx2 = {}
	idx3 = {}
	for t in range(n):
		if l[t] not in idx1:
			idx1[l[t]] = [t + 1]
		else:
			idx1[l[t]].append(t + 1)
		if l[t] not in idx2:
			idx2[l[t]] = [t + 1]
		else:
			idx2[l[t]].append(t + 1)
		if l[t] not in idx3:
			idx3[l[t]] = [t + 1]
		else:
			idx3[l[t]].append(t + 1)
	l.sort()
	for t in l:
		print(idx1[t][-1], end=' ')
		idx1[t].pop()
	print()
	for t in idx2:
		idx2[t].reverse()
	for t in l:
		print(idx2[t][-1], end=' ')
		idx2[t].pop()
	print()
	for t in idx3:
		if len(idx3[t]) >= 2:
			(idx3[t][0], idx3[t][1]) = (idx3[t][1], idx3[t][0])
			break
	for t in l:
		print(idx3[t][-1], end=' ')
		idx3[t].pop()


def gets(lis):
	sort = sorted(list(lis))
	last = None
	ind = None
	do = []
	a = -1
	for h in sort:
		if h == last:
			i = lis.index(h, ind + 1)
			do[a].append(i)
			ind = i
			last = h
		else:
			i = lis.index(h)
			ind = i
			last = h
			a += 1
			do.append([i])
	return do

def permutations(lis):
	lis = list(lis)
	if len(lis) == 0:
		return []
	elif len(lis) == 1:
		return [lis]
	elif len(lis) > 3:
		ans = permutations(lis[0:3])
		for a in ans:
			a += lis[3:]
		return ans
	else:
		perms = []
		for i in range(len(lis)):
			e = lis[i]
			temp = lis[:i] + lis[i + 1:]
			result = permutations(temp)
			for p in result:
				perms.append([e] + p)
		return perms

def check(perms):
	final = [[], [], []]
	method = 'fail'
	use = None
	use2 = []
	for l in perms:
		if len(l) >= 3:
			use = l
			method = '1'
			break
		elif len(l) == 2:
			use2.append(l)
			if len(use2) == 2:
				method = '2'
				break
	if method == 'fail':
		return ('NO', None)
	elif method == '1':
		for l in perms:
			if l == use:
				final[0] += l[0]
				final[1] += l[1]
				final[2] += l[2]
			else:
				final[0] += l[0]
				final[1] += l[0]
				final[2] += l[0]
	elif method == '2':
		for l in perms:
			if l == use2[0]:
				final[0] += l[0]
				final[1] += l[0]
				final[2] += l[1]
			elif l == use2[1]:
				final[0] += l[0]
				final[1] += l[1]
				final[2] += l[1]
			else:
				final[0] += l[0]
				final[1] += l[0]
				final[2] += l[0]
	return ('YES', final)
t = int(input())
v = list(map(int, input().split()))
d = gets(v)
q = []
for su in d:
	q.append(permutations(su))
(ans, order) = check(q)
print(ans)
if ans == 'YES':
	for p in order:
		for o in p:
			print(o + 1, end=' ')
		print()


from collections import Counter
n = int(input())
l = sorted([(i, j) for (i, j) in enumerate(map(int, input().split()), 1)], key=lambda x: x[1])
tmp = [str(i[0]) for i in l]
ans = [' '.join(tmp)]
for i in range(1, n):
	if l[i - 1][1] == l[i][1]:
		(tmp[i], tmp[i - 1]) = (tmp[i - 1], tmp[i])
		ans.append(' '.join(tmp))
		if len(ans) >= 3:
			break
print('YES\n' + '\n'.join(ans) if len(ans) >= 3 else 'NO')


import collections
import itertools
n = int(input())
c = collections.defaultdict(list)
for (i, h) in enumerate(map(int, str.split(input()))):
	c[h].append(i + 1)
s = tuple(map(c.get, sorted(c)))
sl = tuple(map(len, s))
if max(sl) > 2:
	i = sl.index(max(sl))
	print('YES')
	ps = itertools.permutations(s[i], sl[i])
	for perm in itertools.islice(itertools.permutations(s[i], sl[i]), 3):
		print(str.join(' ', map(str, itertools.chain.from_iterable(s[:i] + (perm,) + s[i + 1:]))))
elif sl.count(2) > 1:
	print('YES')
	print(str.join(' ', map(str, itertools.chain.from_iterable(s))))
	i = sl.index(2)
	print(str.join(' ', map(str, itertools.chain.from_iterable(s[:i] + (s[i][::-1],) + s[i + 1:]))))
	i = sl.index(2, i + 1)
	print(str.join(' ', map(str, itertools.chain.from_iterable(s[:i] + (s[i][::-1],) + s[i + 1:]))))
else:
	print('NO')


n = int(input())
l = list(map(int, input().split()))
a = []
for i in range(n):
	a.append((l[i], i + 1))
a.sort()
cnt = 0
i = 0
maxi = 0
while i < n:
	c = 0
	j = i
	while i < n:
		if a[i][0] == a[j][0]:
			c += 1
		else:
			break
		i += 1
	if c > 1:
		cnt += 1
	maxi = max(c, maxi)
if cnt < 1 or (cnt == 1 and maxi < 3):
	print('NO')
else:
	print('YES')
	for i in range(n):
		print(a[i][1], end=' ')
	print()
	for i in range(1, n):
		if a[i][0] == a[i - 1][0]:
			(a[i], a[i - 1]) = (a[i - 1], a[i])
			break
	for i in range(n):
		print(a[i][1], end=' ')
	print()
	for i in range(n - 1, 0, -1):
		if a[i][0] == a[i - 1][0]:
			(a[i], a[i - 1]) = (a[i - 1], a[i])
			break
	for i in range(n):
		print(a[i][1], end=' ')


import os
import sys
from io import BytesIO, IOBase
mod = 10 ** 9 + 7
from collections import Counter

def main():
	n = int(input())
	l = list(map(int, input().split()))
	c = Counter(l)
	temp = 1
	for item in c.values():
		temp *= item
		if temp >= 3:
			break
	else:
		print('NO')
		exit()
	print('YES')
	for i in range(n):
		l[i] = [l[i], i + 1]
	l.sort()
	l1 = []
	l2 = []
	l3 = []
	flag = 0
	i = 0
	while i < n:
		item = l[i]
		if c[item[0]] == 1:
			l1.append(item[1])
			l2.append(item[1])
			l3.append(item[1])
			i += 1
		elif c[item[0]] == 2 and flag == 0:
			item2 = l[i + 1]
			l1.append(item[1])
			l1.append(item2[1])
			l2.append(item2[1])
			l2.append(item[1])
			l3.append(item[1])
			l3.append(item2[1])
			flag = -1
			i += 2
		elif c[item[0]] == 2 and flag == -1:
			item2 = l[i + 1]
			l1.append(item[1])
			l1.append(item2[1])
			l2.append(item[1])
			l2.append(item2[1])
			l3.append(item2[1])
			l3.append(item[1])
			flag = 1
			i += 2
		elif c[item[0]] >= 2 and flag != 1:
			item2 = l[i + 1]
			item3 = l[i + 2]
			l1 += [item[1], item2[1], item3[1]]
			l2 += [item[1], item3[1], item2[1]]
			l3 += [item3[1], item2[1], item[1]]
			flag = 1
			i += 3
		else:
			l1.append(item[1])
			l2.append(item[1])
			l3.append(item[1])
			i += 1
	print(*l1)
	print(*l2)
	print(*l3)

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
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 nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


n = int(input())
arr = sorted(enumerate(map(int, input().split()), 1), key=lambda x: x[1])
ans = [str(x[0]) for x in arr]
q = ['YES', ' '.join(ans)]
for i in range(n - 1):
	if arr[i][1] == arr[i + 1][1]:
		(ans[i], ans[i + 1]) = (ans[i + 1], ans[i])
		q.append(' '.join(ans))
		if len(q) > 3:
			break
print('\n'.join(q) if len(q) > 3 else 'NO')


(n, a, q, w, r) = (int(input()), list(map(int, input().split())), [], [], [0])
for i in range(n):
	q.append([a[i], i + 1])
q.sort()
for i in range(1, n):
	if q[i][0] == q[i - 1][0]:
		r[0] += 1
		r.append(i + 1)
	if r[0] == 2:
		break
for i in q:
	w.append(i[1])
if r[0] == 2:
	print('YES')
	print(*w)
	for i in range(1, 3):
		(w[r[i] - 1], w[r[i] - 2]) = (w[r[i] - 2], w[r[i] - 1])
		print(*w)
else:
	print('NO')


def main():
	(n,) = read()
	a = [(int(x), i + 1) for (i, x) in enumerate(read())]
	a.sort()
	ct = []
	for i in range(n - 1):
		if a[i][0] == a[i + 1][0]:
			ct.append(i)
	if len(ct) < 2:
		print('NO')
		return
	a1 = []
	a2 = []
	a3 = []
	for i in range(n):
		a1.append(a[i][1])
		if i == ct[0]:
			a2.append(a[i + 1][1])
		elif i == ct[0] + 1:
			a2.append(a[i - 1][1])
		else:
			a2.append(a[i][1])
		if i == ct[1]:
			a3.append(a[i + 1][1])
		elif i == ct[1] + 1:
			a3.append(a[i - 1][1])
		else:
			a3.append(a[i][1])
	print('YES')
	write(a1)
	print()
	write(a2)
	print()
	write(a3)

def read(mode=2):
	inputs = input().strip()
	if mode == 0:
		return inputs
	if mode == 1:
		return inputs.split()
	if mode == 2:
		return list(map(int, inputs.split()))

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='')
write(main())


n = int(input())
diff = input().split()
o = enumerate(map(int, diff), 1)
tasks = list(o)
tasks.sort(key=lambda diffi: diffi[1])
i = 0
while i < n - 1:
	if tasks[i][1] == tasks[i + 1][1]:
		break
	i += 1
j = i + 1
while j < n - 1:
	if tasks[j][1] == tasks[j + 1][1]:
		break
	j += 1
if j > n - 2:
	print('NO')
else:
	print('YES')
	tasks = [str(i) for (i, j) in tasks]
	print(' '.join(tasks))
	(tasks[i], tasks[i + 1]) = (tasks[i + 1], tasks[i])
	print(' '.join(tasks))
	(tasks[j], tasks[j + 1]) = (tasks[j + 1], tasks[j])
	print(' '.join(tasks))


from collections import Counter
n = int(input())
a = list(map(int, input().split(' ')))
counter = Counter(a)
extra = 0
for i in counter:
	extra += counter[i] - 1
if extra <= 1:
	print('NO')
else:
	b = [(a[i], i + 1) for i in range(n)]
	b.sort()
	print('YES')
	x = [b[i][1] for i in range(n)]
	print(' '.join(map(str, x)))
	times = 0
	for i in range(n - 1):
		if b[i][0] == b[i + 1][0]:
			tmp = b[i]
			b[i] = b[i + 1]
			b[i + 1] = tmp
			times += 1
			x = [b[j][1] for j in range(n)]
			print(' '.join(map(str, x)))
		if times == 2:
			break


n = int(input())
difficulties = list(map(int, input().split()))
sd = sorted([[difficulties[i], i] for i in range(n)], key=lambda k: k[0])
t = 0
bk = False
for i in range(0, n - 1):
	if sd[i][0] == sd[i + 1][0]:
		t += 1
	if t == 2:
		print('YES')
		print(*[sd[j][1] + 1 for j in range(0, n)])
		t = 0
		for k in range(0, n - 1):
			if sd[k][0] == sd[k + 1][0]:
				t += 1
				s = sd[k + 1][1]
				sd[k + 1][1] = sd[k][1]
				sd[k][1] = s
				print(*[sd[k][1] + 1 for k in range(0, n)])
				s = sd[k + 1][1]
				sd[k + 1][1] = sd[k][1]
				sd[k][1] = s
			if t == 2:
				bk = True
				break
	if bk == True:
		break
if not bk:
	print('NO')


n = int(input())
s = [int(i) for i in input().split()]
li = []
for i in range(1, n + 1):
	li.append([s[i - 1], i])
li.sort()
ans = [[str(i[1]) for i in li]]
for i in range(n - 1):
	if li[i][0] == li[i + 1][0]:
		(li[i], li[i + 1]) = (li[i + 1], li[i])
		ans.append([str(i[1]) for i in li])
		if len(ans) >= 3:
			break
if len(ans) >= 3:
	print('YES')
	print(' '.join(ans[0]))
	print(' '.join(ans[1]))
	print(' '.join(ans[2]))
else:
	print('NO')


def print_permutation(array):
	temp = ''
	for ar in array:
		temp += str(ar[1]) + ' '
	return temp.strip()
n = int(input().strip())
a = list(map(int, input().split()))
for i in range(n):
	a[i] = (a[i], i + 1)
a.sort(key=lambda t: t[0])
b = a.copy()
index = 0
count = 1
for i in range(n - 1):
	if b[i][0] == b[i + 1][0]:
		temp = b[i]
		b[i] = b[i + 1]
		b[i + 1] = temp
		index = i + 1
		count += 1
		break
c = b.copy()
for i in range(index, n - 1):
	if c[i][0] == c[i + 1][0]:
		temp = c[i]
		c[i] = c[i + 1]
		c[i + 1] = temp
		count += 1
		break
if count == 3:
	print('YES')
	print(print_permutation(a))
	print(print_permutation(b))
	print(print_permutation(c))
else:
	print('NO')


import sys
import math
n = int(sys.stdin.readline())
hn = [int(x) for x in sys.stdin.readline().split()]
a = []
b = []
c = []
d = dict()
for i in range(n):
	if hn[i] in d:
		d[hn[i]].append(i + 1)
	else:
		d[hn[i]] = [i + 1]
y = list(d.keys())
y.sort()
f = 0
for i in y:
	if len(d[i]) > 2:
		k = d[i]
		a.append(k[0])
		a.append(k[1])
		a.append(k[2])
		a.extend(k[3:])
		b.append(k[1])
		b.append(k[0])
		b.append(k[2])
		b.extend(k[3:])
		c.append(k[2])
		c.append(k[1])
		c.append(k[0])
		c.extend(k[3:])
		f += 2
	elif len(d[i]) == 2:
		k = d[i]
		if f % 2 != 0:
			a.append(k[0])
			a.append(k[1])
			b.append(k[1])
			b.append(k[0])
			c.append(k[0])
			c.append(k[1])
		else:
			a.append(k[0])
			a.append(k[1])
			b.append(k[1])
			b.append(k[0])
			c.append(k[1])
			c.append(k[0])
		f += 1
	else:
		a.append(d[i][0])
		b.append(d[i][0])
		c.append(d[i][0])
if f > 1:
	print('YES')
	print(' '.join([str(x) for x in a]))
	print(' '.join([str(x) for x in b]))
	print(' '.join([str(x) for x in c]))
else:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
	b.append((a[i], i + 1))

def counting_sort(A, k):
	n = len(A)
	C = [0] * k
	B = [0] * n
	one = two = three = -1
	for i in range(n):
		C[A[i][0]] += 1
		if C[A[i][0]] > 2 and three == -1:
			three = A[i][0]
		elif C[A[i][0]] > 1:
			if one == -1:
				one = A[i][0]
			if one != A[i][0] != -1 and two == -1:
				two = A[i][0]
	for i in range(1, k):
		C[i] += C[i - 1]
	for i in range(n - 1, -1, -1):
		C[A[i][0]] -= 1
		B[C[A[i][0]]] = A[i]
	return (B, one, two, three)
(b, one, two, three) = counting_sort(b, 2001)
if one == -1 or (two == -1 and three == -1):
	print('NO')
else:
	if one > two:
		(one, two) = (two, one)

	def print_sol(b):
		for i in range(len(b)):
			print(b[i][1], end=' ')
		print()
	if three != -1:
		three_index = -1
		for i in range(n):
			if b[i][0] == three:
				three_index = i
				break
		print('YES')
		print_sol(b)
		(b[three_index], b[three_index + 1]) = (b[three_index + 1], b[three_index])
		print_sol(b)
		(b[three_index], b[three_index + 2]) = (b[three_index + 2], b[three_index])
		print_sol(b)
	else:
		one_index = two_index = -1
		for i in range(n):
			if b[i][0] == one and one_index == -1:
				one_index = i
			elif b[i][0] == two and two_index == -1:
				two_index = i
		print('YES')
		print_sol(b)
		(b[one_index], b[one_index + 1]) = (b[one_index + 1], b[one_index])
		print_sol(b)
		(b[two_index], b[two_index + 1]) = (b[two_index + 1], b[two_index])
		print_sol(b)


from sys import stdin

def arr_enu():
	return sorted([[i + 1, int(x)] for (i, x) in enumerate(stdin.readline().split())], key=lambda x: x[1])
(n, a, i, ans, flag) = (int(input()), arr_enu(), 0, [[], [], []], 0)
while i < n:
	if i < n - 2 and a[i][1] == a[i + 1][1] == a[i + 2][1] and (flag < 2):
		ans[0].extend([a[i][0], a[i + 1][0], a[i + 2][0]])
		ans[1].extend([a[i + 2][0], a[i + 1][0], a[i][0]])
		ans[2].extend([a[i + 1][0], a[i][0], a[i + 2][0]])
		i += 3
		flag += 2
	elif i < n - 1 and a[i][1] == a[i + 1][1] and (flag < 2):
		if flag == 0:
			ans[1].extend([a[i + 1][0], a[i][0]])
			ans[2].extend([a[i + 1][0], a[i][0]])
		else:
			ans[1].extend([a[i][0], a[i + 1][0]])
			ans[2].extend([a[i + 1][0], a[i][0]])
		ans[0].extend([a[i][0], a[i + 1][0]])
		flag += 1
		i += 2
	else:
		for j in range(3):
			ans[j].append(a[i][0])
		i += 1
if ans[0] != ans[1] != ans[2]:
	print('YES')
	for j in range(3):
		print(*ans[j])
else:
	print('NO')


while True:
	try:
		n = int(input())
		tasks = list(enumerate(map(int, input().split()), 1))
		tasks.sort(key=lambda x: x[1])
		i = 0
		while i < n - 1:
			if tasks[i][1] == tasks[i + 1][1]:
				break
			i += 1
		j = i + 1
		while j < n - 1:
			if tasks[j][1] == tasks[j + 1][1]:
				break
			j += 1
		if j > n - 2:
			print('NO')
		else:
			print('YES')
			tasks = [str(id) for (id, difficulty) in tasks]
			print(' '.join(tasks))
			(tasks[i], tasks[i + 1]) = (tasks[i + 1], tasks[i])
			print(' '.join(tasks))
			(tasks[j], tasks[j + 1]) = (tasks[j + 1], tasks[j])
			print(' '.join(tasks))
	except:
		break


n = int(input())
h = [[0, i + 1] for i in range(n)]
a = list(map(int, input().split()))
for i in range(n):
	h[i][0] = a[i]
h.sort(key=lambda x: x[0])
cnt = 0
for i in range(n - 1):
	if h[i][0] == h[i + 1][0]:
		cnt += 1
if cnt < 2:
	print('NO')
else:
	print('YES')
	(swap1, swap2) = (-1, -1)
	for i in range(n - 1):
		if swap1 == -1 and h[i][0] == h[i + 1][0]:
			swap1 = i
		elif swap1 != -1 and swap2 == -1 and (h[i][0] == h[i + 1][0]):
			swap2 = i
			break
	for i in range(n):
		print(h[i][1], end=' ')
	print('')
	for i in range(swap1):
		print(h[i][1], end=' ')
	print(h[swap1 + 1][1], h[swap1][1], end=' ')
	for i in range(swap1 + 2, n):
		print(h[i][1], end=' ')
	print('')
	for i in range(swap2):
		print(h[i][1], end=' ')
	print(h[swap2 + 1][1], h[swap2][1], end=' ')
	for i in range(swap2 + 2, n):
		print(h[i][1], end=' ')


class ToDo:

	def __init__(self, height, _id):
		self.height = height
		self.id = _id
N = int(input())
h = list(map(int, input().split()))
task = []
for i in range(N):
	task.append(ToDo(h[i], i + 1))
task = sorted(task, key=lambda t: t.height)
canSwap = [-1] * 2
case = 0
for i in range(0, N - 1):
	if task[i].height == task[i + 1].height:
		canSwap[case] = i
		case += 1
		if case == 2:
			break
if case != 2:
	print('NO')
else:
	print('YES')
	for i in range(N):
		print(task[i].id, end=' ')
	print()
	(task[canSwap[0]].id, task[canSwap[0] + 1].id) = (task[canSwap[0] + 1].id, task[canSwap[0]].id)
	for i in range(N):
		print(task[i].id, end=' ')
	print()
	(task[canSwap[1]].id, task[canSwap[1] + 1].id) = (task[canSwap[1] + 1].id, task[canSwap[1]].id)
	for i in range(N):
		print(task[i].id, end=' ')


n = int(input())
jobs = list(map(int, input().split()))
jobs = sorted(list(map(lambda x: (x[1], x[0] + 1), enumerate(jobs))))
r3 = None
r21 = None
r22 = None
for i in range(n):
	if i + 2 < n and jobs[i][0] == jobs[i + 1][0] and (jobs[i][0] == jobs[i + 2][0]):
		r3 = i
		break
	if i + 1 < n and jobs[i][0] == jobs[i + 1][0]:
		if r21 is None:
			r21 = i
		else:
			r22 = i
			break
jobs = list(map(lambda x: x[1], jobs))
if r3 is None and r22 is None:
	print('NO')
elif r3 is not None:
	print('YES')
	print(*jobs)
	print(*jobs[:r3] + [jobs[r3 + 2]] + [jobs[r3]] + [jobs[r3 + 1]] + jobs[r3 + 3:])
	print(*jobs[:r3] + [jobs[r3 + 1]] + [jobs[r3 + 2]] + [jobs[r3]] + jobs[r3 + 3:])
else:
	print('YES')
	print(*jobs)
	print(*jobs[:r21] + [jobs[r21]] + [jobs[r21 + 1]] + jobs[r21 + 2:r22] + [jobs[r22 + 1]] + [jobs[r22]] + jobs[r22 + 2:])
	print(*jobs[:r21] + [jobs[r21 + 1]] + [jobs[r21]] + jobs[r21 + 2:r22] + [jobs[r22]] + [jobs[r22 + 1]] + jobs[r22 + 2:])


class Node:

	def __init__(self, a=None, b=None):
		self.val = a
		self.id = b

	def __lt__(self, other):
		return self.val < other.val
n = int(input())
a = list(map(int, input().split()))
h = []
res = []
for i in range(len(a)):
	h.append(Node(a[i], i + 1))
h.sort()
res.append(h)
for i in range(len(h)):
	if len(res) >= 3:
		break
	for j in range(i + 1, len(h)):
		if h[i].val == h[j].val:
			tmp = h[:]
			(tmp[i], tmp[j]) = (tmp[j], tmp[i])
			res.append(tmp)
			if len(res) >= 3:
				break
if len(res) >= 3:
	print('YES')
	for i in range(len(res)):
		for j in res[i]:
			print(j.id, end=' ')
		print()
else:
	print('NO')


n = int(input())
numbers = list(map(int, input().split()))
numbers = [(x, numbers[x]) for x in range(n)]
numbers = sorted(numbers, key=lambda x: x[1])
occurences = [0 for x in range(2001)]
for num in numbers:
	occurences[num[1]] = occurences[num[1]] + 1
two = []
three = []
for i in range(2001):
	if occurences[i] > 1:
		if occurences[i] == 2:
			two.append(i)
		else:
			three.append(i)

def print_list(list):
	print(' '.join([str(x[0] + 1) for x in list]))

def permute_two(list, num):
	for i in range(n):
		if list[i][1] == num:
			t = list[i]
			list[i] = list[i + 1]
			list[i + 1] = t
			break
	return list
if len(two) > 1:
	print('YES')
	print_list(numbers)
	print_list(permute_two(numbers, two[0]))
	print_list(permute_two(numbers, two[1]))
elif len(three) > 0:
	print('YES')
	print_list(numbers)
	print_list(permute_two(numbers, three[0]))
	print_list(reversed(permute_two(list(reversed(numbers)), three[0])))
else:
	print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
for i in range(n):
	arr[i] = (arr[i], i + 1)
arr.sort()
b = False
z = 0
k = 0
r = 0
for i in range(n):
	j = i
	while j < n and arr[j][0] == arr[i][0]:
		j += 1
	if j - i > 2:
		z = i
		r = 3
		break
	if j - i == 2:
		if b:
			r = 2
			k = i
			break
		else:
			z = i
			b = True
	i = j - 1
else:
	print('NO')
if r == 3:
	print('YES')
	for i in range(n):
		print(arr[i][1], end=' ')
	print()
	for i in range(z):
		print(arr[i][1], end=' ')
	print(arr[z + 1][1], arr[z + 2][1], arr[z][1], end=' ')
	for i in range(z + 3, n):
		print(arr[i][1], end=' ')
	print()
	for i in range(z):
		print(arr[i][1], end=' ')
	print(arr[z + 2][1], arr[z + 1][1], arr[z][1], end=' ')
	for i in range(z + 3, n):
		print(arr[i][1], end=' ')
elif r == 2:
	print('YES')
	for i in range(n):
		print(arr[i][1], end=' ')
	print()
	for i in range(z):
		print(arr[i][1], end=' ')
	print(arr[z + 1][1], arr[z][1], end=' ')
	for i in range(z + 2, n):
		print(arr[i][1], end=' ')
	print()
	for i in range(k):
		print(arr[i][1], end=' ')
	print(arr[k + 1][1], arr[k][1], end=' ')
	for i in range(k + 2, n):
		print(arr[i][1], end=' ')


def solution():
	N = int(input())
	tasks = list(map(int, input().split()))
	markers = {}
	for i in range(N):
		if markers.get(tasks[i]) is None:
			markers[tasks[i]] = [1]
		markers[tasks[i]].append(i)
	possible = False
	possible_count = 1
	duplications = []
	duplicated_keys = []
	for (key, marker) in markers.items():
		if len(marker) == 3:
			possible_count *= 2
			duplications.append(marker)
			duplicated_keys.append(key)
			if possible_count >= 3:
				possible = True
				break
		elif len(marker) >= 4:
			possible = True
			duplications = [marker]
			duplicated_keys = [key]
			break
	if not possible:
		print('NO')
		return
	print('YES')
	tasks.sort()
	if len(duplications) == 2:
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
		(markers[duplicated_keys[0]][2], markers[duplicated_keys[0]][1]) = (markers[duplicated_keys[0]][1], markers[duplicated_keys[0]][2])
		for marker in markers.values():
			marker[0] = 1
		print()
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
		for marker in markers.values():
			marker[0] = 1
		print()
		(markers[duplicated_keys[1]][2], markers[duplicated_keys[1]][1]) = (markers[duplicated_keys[1]][1], markers[duplicated_keys[1]][2])
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
	if len(duplications) == 1:
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
		print()
		for marker in markers.values():
			marker[0] = 1
		(markers[duplicated_keys[0]][2], markers[duplicated_keys[0]][1]) = (markers[duplicated_keys[0]][1], markers[duplicated_keys[0]][2])
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
		print()
		for marker in markers.values():
			marker[0] = 1
		(markers[duplicated_keys[0]][2], markers[duplicated_keys[0]][3]) = (markers[duplicated_keys[0]][3], markers[duplicated_keys[0]][2])
		for i in range(N):
			print(markers[tasks[i]][markers[tasks[i]][0]] + 1, end=' ')
			if markers[tasks[i]][0] == len(markers[tasks[i]]) - 1:
				markers[tasks[i]][0] = 1
			else:
				markers[tasks[i]][0] += 1
solution()


def STR():
	return list(input())

def INT():
	return int(input())

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

def MAP2():
	return map(float, input().split())

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

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
arr = LIST()
d = []
d2 = {}
for i in range(n):
	d.append([i, arr[i]])
	if arr[i] not in d2:
		d2[arr[i]] = 1
	else:
		d2[arr[i]] += 1
d.sort(key=lambda x: x[1])
c = Counter(arr)
v = list(c.values())
v.sort(reverse=True)
flag = False
mx = v[0]
if mx > 2:
	flag = True
if mx == 2 and v.count(mx) > 1:
	flag = True
if flag == False:
	print('NO')
else:
	print('YES')
	ans1 = []
	ans2 = []
	ans3 = []
	c = 0
	i = 0
	while i < n:
		x = d[i][1]
		y = d[i][0] + 1
		if d2[x] == 1:
			ans1.append(y)
			ans2.append(y)
			ans3.append(y)
			i += 1
		elif c < 2:
			if d2[x] == 2:
				y2 = d[i + 1][0] + 1
				if c == 0:
					ans1 += [y, y2]
					ans2 += [y2, y]
					ans3 += [y, y2]
				else:
					ans1 += [y, y2]
					ans2 += [y, y2]
					ans3 += [y2, y]
				c += 1
				i += 2
			else:
				y2 = d[i + 1][0] + 1
				y3 = d[i + 2][0] + 1
				ans1 += [y, y2, y3]
				ans2 += [y2, y, y3]
				ans3 += [y3, y2, y]
				c += 1
				i += 3
		else:
			ans1.append(y)
			ans2.append(y)
			ans3.append(y)
			i += 1
	print(*ans1)
	print(*ans2)
	print(*ans3)


n = int(input())
A = list(map(int, input().split()))
D = [[] for i in range(2001)]
for i in range(n):
	D[A[i]].append(i + 1)
D1 = []
D2 = []
D3 = []
three = 0
two = 0
bla = True
for i in range(1, 2001):
	if len(D[i]) >= 3:
		D1.extend(D[i])
		D2.extend(D[i][::-1])
		D3.extend(D[i][len(D[i]) // 2:])
		D3.extend(D[i][:len(D[i]) // 2])
		three += 1
	elif len(D[i]) == 2:
		two += 1
		if bla:
			D1.extend(D[i])
			D2.extend(D[i])
			D3.extend([D[i][1], D[i][0]])
		else:
			D1.extend(D[i])
			D2.extend([D[i][1], D[i][0]])
			D3.extend([D[i][1], D[i][0]])
		bla = not bla
	elif len(D[i]) == 1:
		D1.append(D[i][0])
		D2.append(D[i][0])
		D3.append(D[i][0])
if three > 0 or two > 1:
	print('YES')
	print(' '.join(map(str, D1)))
	print(' '.join(map(str, D2)))
	print(' '.join(map(str, D3)))
else:
	print('NO')


n = int(input())
arr = [int(i) for i in input().split()]
arr = [(i + 1, arr[i]) for i in range(n)]
arr.sort(key=lambda x: x[1])
i = 0
while i < n - 1 and arr[i][1] != arr[i + 1][1]:
	i += 1
j = i + 1
while j < n - 1 and arr[j][1] != arr[j + 1][1]:
	j += 1
if j > n - 2:
	print('NO')
	exit()
print('YES')
res = [str(i) for (i, j) in arr]
print(*res)
(res[i], res[i + 1]) = (res[i + 1], res[i])
print(*res)
(res[j], res[j + 1]) = (res[j + 1], res[j])
print(*res)


n = int(input())
t = list(enumerate(map(int, input().split()), 1))
t.sort(key=lambda x: x[1])
i = 0
while i < n - 1:
	if t[i][1] == t[i + 1][1]:
		break
	i += 1
j = i + 1
while j < n - 1:
	if t[j][1] == t[j + 1][1]:
		break
	j += 1
if j > n - 2:
	print('NO')
else:
	print('YES')
	t = [str(i) for (i, j) in t]
	print(' '.join(t))
	(t[i], t[i + 1]) = (t[i + 1], t[i])
	print(' '.join(t))
	(t[j], t[j + 1]) = (t[j + 1], t[j])
	print(' '.join(t))


n = int(input())
a = list(map(int, input().split()))
d = [0] * n
b = [0] * 2001
s = 0
f = [[] for i in range(2001)]
c = [[] for i in range(3)]
for i in range(len(a)):
	b[a[i]] = b[a[i]] + 1
	d[i] = [a[i], i + 1]
	f[a[i]].append(i + 1)
c1 = 0
for i in range(len(b)):
	if b[i] >= 2:
		if b[i] >= 3:
			c1 = c1 + 1
		s = s + 1
if s < 2 and c1 != 1:
	print('NO')
else:
	print('YES')
	s = 0
	for i in range(len(f)):
		for j in range(len(f[i])):
			c[0].append(f[i][j])
	print(*c[0])
	mark = [False] * 2001
	for i in range(len(f)):
		if len(f[i]) == 1:
			c[1].append(f[i][0])
		elif len(f[i]) == 2:
			if s == 0:
				c[1].append(f[i][1])
				c[1].append(f[i][0])
				s = s + 1
				mark[i] = True
			else:
				c[1].append(f[i][0])
				c[1].append(f[i][1])
		elif len(f[i]) > 2:
			if s == 0:
				c[1].append(f[i][1])
				c[1].append(f[i][0])
				for j in range(2, len(f[i])):
					c[1].append(f[i][j])
			else:
				for j in range(len(f[i])):
					c[1].append(f[i][j])
	print(*c[1])
	s = 0
	for i in range(len(f)):
		if len(f[i]) == 1:
			c[2].append(f[i][0])
		elif len(f[i]) == 2:
			if mark[i] == False and s == 0:
				c[2].append(f[i][1])
				c[2].append(f[i][0])
				mark[i] = True
				s = s + 1
			else:
				c[2].append(f[i][0])
				c[2].append(f[i][1])
		elif len(f[i]) > 2:
			if s == 0:
				c[2].append(f[i][2])
				c[2].append(f[i][0])
				c[2].append(f[i][1])
				for j in range(3, len(f[i])):
					c[2].append(f[i][j])
			else:
				for j in range(len(f[i])):
					c[2].append(f[i][j])
			s = s + 1
	print(*c[2])


n = int(input())
list = input().split()
for i in range(len(list)):
	list[i] = int(list[i])
tab = [[] for loop in range(2001)]
for i in range(len(list)):
	tab[list[i]].append(i + 1)
a = 0
b = 0
c = 0
for i in range(2001):
	if len(tab[i]) >= 3:
		a = i
	if len(tab[i]) >= 2 and b != 0 and (c == 0):
		c = i
	if len(tab[i]) >= 2 and b == 0:
		b = i
if c < b:
	temp = c
	c = b
	b = temp

def pri(l):
	for i in range(len(l)):
		print(l[i], end=' ')
if a != 0:
	print('YES')
	x = tab[a].pop(0)
	y = tab[a].pop(0)
	z = tab[a].pop(0)
	for i in range(a):
		if tab[i] != []:
			pri(tab[i])
	print(x, y, z, end=' ')
	for i in range(a, 2001):
		if tab[i] != []:
			pri(tab[i])
	print()
	for i in range(a):
		if tab[i] != []:
			pri(tab[i])
	print(y, x, z, end=' ')
	for i in range(a, 2001):
		if tab[i] != []:
			pri(tab[i])
	print()
	for i in range(a):
		if tab[i] != []:
			pri(tab[i])
	print(z, y, x, end=' ')
	for i in range(a, 2001):
		if tab[i] != []:
			pri(tab[i])
elif b != 0 and c != 0:
	print('YES')
	x = tab[b].pop(0)
	y = tab[b].pop(0)
	z = tab[c].pop(0)
	t = tab[c].pop(0)
	for i in range(b):
		if tab[i] != []:
			pri(tab[i])
	print(x, y, end=' ')
	for i in range(b, c):
		if tab[i] != []:
			pri(tab[i])
	print(z, t, end=' ')
	for i in range(c, 2001):
		if tab[i] != []:
			pri(tab[i])
	print()
	for i in range(b):
		if tab[i] != []:
			pri(tab[i])
	print(y, x, end=' ')
	for i in range(b, c):
		if tab[i] != []:
			pri(tab[i])
	print(z, t, end=' ')
	for i in range(c, 2001):
		if tab[i] != []:
			pri(tab[i])
	print()
	for i in range(b):
		if tab[i] != []:
			pri(tab[i])
	print(x, y, end=' ')
	for i in range(b, c):
		if tab[i] != []:
			pri(tab[i])
	print(t, z, end=' ')
	for i in range(c, 2001):
		if tab[i] != []:
			pri(tab[i])
	print()
else:
	print('NO')


n = int(input())
tmp = [int(i) for i in input().split()]
li = []
for i in range(1, n + 1):
	li.append([tmp[i - 1], i])
li.sort()
seq = [str(i[1]) for i in li]
two = []
three = []
for i in set(tmp):
	cnt = tmp.count(i)
	if cnt == 2:
		two.append(i)
	elif cnt >= 3:
		three.append(i)
if three:
	pos = seq.index(str(tmp.index(three[0]) + 1))
	print('YES')
	print(' '.join(seq))
	(seq[pos], seq[pos + 1]) = (seq[pos + 1], seq[pos])
	print(' '.join(seq))
	(seq[pos + 1], seq[pos + 2]) = (seq[pos + 2], seq[pos + 1])
	print(' '.join(seq))
elif len(two) >= 2:
	pos1 = seq.index(str(tmp.index(two[0]) + 1))
	pos2 = seq.index(str(tmp.index(two[1]) + 1))
	print('YES')
	print(' '.join(seq))
	(seq[pos1], seq[pos1 + 1]) = (seq[pos1 + 1], seq[pos1])
	print(' '.join(seq))
	(seq[pos2], seq[pos2 + 1]) = (seq[pos2 + 1], seq[pos2])
	print(' '.join(seq))
else:
	print('NO')


n = int(input())
tasks = list(map(int, input().split()))
tasksTuple = [(i + 1, x) for (i, x) in enumerate(tasks)]
tasksTuple.sort(key=lambda tup: tup[1])
pairs = []
for i in range(0, len(tasksTuple) - 1):
	if tasksTuple[i][1] == tasksTuple[i + 1][1]:
		pairs.append((tasksTuple[i][0], tasksTuple[i + 1][0]))
if len(pairs) >= 2:
	print('YES')
	printedArray = ['', '', '']
	for i in range(len(tasksTuple)):
		numberPrint1 = tasksTuple[i][0]
		numberPrint2 = tasksTuple[i][0]
		numberPrint3 = tasksTuple[i][0]
		if tasksTuple[i][0] == pairs[0][0]:
			numberPrint2 = pairs[0][1]
		if tasksTuple[i][0] == pairs[0][1]:
			numberPrint2 = pairs[0][0]
		if tasksTuple[i][0] == pairs[1][0]:
			numberPrint3 = pairs[1][1]
		if tasksTuple[i][0] == pairs[1][1]:
			numberPrint3 = pairs[1][0]
		if i == len(tasksTuple) - 1:
			printedArray[0] = printedArray[0] + str(numberPrint1)
			printedArray[1] = printedArray[1] + str(numberPrint2)
			printedArray[2] = printedArray[2] + str(numberPrint3)
		else:
			printedArray[0] = printedArray[0] + str(numberPrint1) + ' '
			printedArray[1] = printedArray[1] + str(numberPrint2) + ' '
			printedArray[2] = printedArray[2] + str(numberPrint3) + ' '
	for i in range(len(printedArray)):
		print(printedArray[i])
else:
	print('NO')


from itertools import permutations
n = int(input())
l = list(map(int, input().split()))
d = {}
d2 = {}
res = []
c = 0

def bf(x, indeks=0):
	global c
	if c < 3:
		if indeks == le:
			for i in res:
				print(*i, end=' ')
			print()
			c += 1
		else:
			for i in permutations(x[indeks], len(x[indeks])):
				res.append(i)
				bf(x, indeks + 1)
				res.pop()
				if c >= 3:
					break
for i in range(len(l)):
	try:
		d[l[i]].append(i + 1)
		d2[l[i]] += 1
	except:
		d[l[i]] = [i + 1]
		d2[l[i]] = 1
r = 1
for i in d2.values():
	r *= i
if r < 3:
	print('NO')
else:
	print('YES')
	p = dict(sorted(d.items(), key=lambda item: item[0]))
	k = list(p.values())
	le = len(k)
	bf(k)


n = int(input())
l = list(map(int, input().split()))
ques = []
for i in range(n):
	ques.append((i, l[i]))
ques = sorted(ques, key=lambda x: (x[1], x[0]))
check = 0
for i in range(n - 1):
	if ques[i][1] == ques[i + 1][1]:
		check += 1
	if check == 2:
		print('YES')
		for j in range(n):
			print(ques[j][0] + 1, end=' ')
		print()
		count = 0
		for j in range(n - 1):
			if ques[j][1] == ques[j + 1][1]:
				count += 1
				(ques[j], ques[j + 1]) = (ques[j + 1], ques[j])
				for k in range(n):
					print(ques[k][0] + 1, end=' ')
				print()
				(ques[j], ques[j + 1]) = (ques[j + 1], ques[j])
			if count == 2:
				exit()
print('NO')


import sys

def swap_arr_el(arr, i, j):
	c = arr[i]
	arr[i] = arr[j]
	arr[j] = c
n = int(input())
arr = input()
arr = arr.split(' ')
for i in range(0, len(arr)):
	arr[i] = int(arr[i])
arr_t = []
for i in range(0, len(arr)):
	arr_t.append((i, arr[i]))
swap_idxes = []
for i in range(0, len(arr_t) - 1):
	curmin = 100000000000000000
	curmin_idx = None
	for j in range(i, len(arr_t)):
		if arr_t[j][1] < curmin:
			curmin = arr_t[j][1]
			curmin_idx = j
	swap_arr_el(arr_t, i, curmin_idx)
	if i >= 1 and arr_t[i][1] == arr_t[i - 1][1]:
		swap_idxes.append(i - 1)
if len(arr_t) >= 2 and arr_t[-1][1] == arr_t[-2][1]:
	swap_idxes.append(-2)
if len(swap_idxes) < 2:
	print('NO')
else:
	print('YES')
	ans = []
	for i in range(0, len(arr_t)):
		ans.append(str(arr_t[i][0] + 1))
	print(' '.join(ans))
	swap_arr_el(ans, swap_idxes[0], swap_idxes[0] + 1)
	print(' '.join(ans))
	swap_arr_el(ans, swap_idxes[1], swap_idxes[1] + 1)
	print(' '.join(ans))


n = int(input())
a = [int(i) for i in input().split()]
s = sorted([(a[i], i) for i in range(n)])
f = [s[i][1] for i in range(n)]
swp = []
for i in range(n - 1):
	if s[i][0] == s[i + 1][0]:
		swp.append((i, i + 1))
	if len(swp) == 2:
		print('YES')
		print(' '.join((str(k + 1) for k in f)))
		for (i, j) in swp:
			(f[i], f[j]) = (f[j], f[i])
			print(' '.join((str(l + 1) for l in f)))
		exit()
print('NO')


n = int(input())
a = list(map(int, input().split()))
num = [[] for i in range(2001)]
d = set()
cnt = 0
for i in range(n):
	num[a[i]].append(i)
	if a[i] not in d:
		d.add(a[i])
		cnt += 1
if cnt > n - 2:
	print('NO')
else:
	M = []
	U = []
	H = []
	cnt = 0
	for i in num:
		if len(i) > 2:
			for j in range(len(i)):
				M.append(i[j] + 1)
				U.append(i[(j + 1) % len(i)] + 1)
				H.append(i[(j + 2) % len(i)] + 1)
		elif len(i) == 2 and cnt % 2 == 0:
			M.append(i[0] + 1)
			U.append(i[1] + 1)
			H.append(i[1] + 1)
			M.append(i[1] + 1)
			U.append(i[0] + 1)
			H.append(i[0] + 1)
			cnt += 1
		elif len(i) == 2:
			M.append(i[0] + 1)
			U.append(i[0] + 1)
			H.append(i[1] + 1)
			M.append(i[1] + 1)
			U.append(i[1] + 1)
			H.append(i[0] + 1)
			cnt += 1
		elif len(i) > 0:
			M.append(i[0] + 1)
			U.append(i[0] + 1)
			H.append(i[0] + 1)
	print('YES')
	print(*M)
	print(*U)
	print(*H)


x = int(input())
data = list(map(int, input().split(' ')))
prod = 1
data2 = []
for i in range(x):
	data2.append([data[i], i + 1])
data2.sort(key=lambda x: x[0])
data.sort()
listx = []
swaps = 0
listx.append(' '.join([str(i[1]) for i in data2]))
for i in range(x - 1):
	if swaps >= 2:
		break
	elif data2[i][0] == data2[i + 1][0]:
		(data2[i][1], data2[i + 1][1]) = (data2[i + 1][1], data2[i][1])
		listx.append(' '.join([str(i[1]) for i in data2]))
		swaps += 1
if swaps < 2:
	print('NO')
else:
	print('YES')
	for i in listx:
		print(i)


n = int(input())
a = list(map(int, input().split()))
b = [0] * 2001
c = [[] for i in range(2001)]
for i in range(n):
	b[a[i]] += 1
	c[a[i]].append(i + 1)
ans = []
ans.append([])
for i in range(2001):
	if b[i] >= 1:
		if b[i] == 1 or len(ans) == 3:
			for j in ans:
				j += c[i]
		elif b[i] == 2:
			t = [j for j in ans[0]]
			ans.append(t)
			for j in ans:
				j += c[i]
			(ans[len(ans) - 1][-1], ans[len(ans) - 1][-2]) = (ans[len(ans) - 1][-2], ans[len(ans) - 1][-1])
		elif b[i] >= 3:
			t = [j for j in ans[0]]
			ans.append(t)
			for j in ans:
				j += c[i]
			(ans[len(ans) - 1][-1], ans[len(ans) - 1][-2]) = (ans[len(ans) - 1][-2], ans[len(ans) - 1][-1])
			if len(ans) == 2:
				t = [j for j in ans[0]]
				ans.append(t)
				(ans[len(ans) - 1][-1], ans[len(ans) - 1][-3]) = (ans[len(ans) - 1][-3], ans[len(ans) - 1][-1])
if len(ans) == 3:
	print('YES')
	for i in range(3):
		for j in ans[i]:
			print(j, end=' ')
		print()
else:
	print('NO')


n = input()
a = list(map(int, input().split()))
index = sorted(range(len(a)), key=lambda k: a[k])
a = sorted(a)
for i in range(len(index)):
	index[i] += 1
i = 1
count = 1
ans = list()
ans.append(index)
while i < len(a):
	if a[i] == a[i - 1]:
		(index[i], index[i - 1]) = (index[i - 1], index[i])
		ans.append(list(index))
		(index[i], index[i - 1]) = (index[i - 1], index[i])
		count += 1
		if count == 3:
			break
	i += 1
if count == 3:
	print('YES')
	for i in range(3):
		for j in range(len(ans[i])):
			print(ans[i][j])
		print()
else:
	print('NO')


def print_plan(plan):
	for task in plan:
		print(task[1], end=' ')
	print()
n = int(input())
h = list(map(int, input().split()))
tasks = []
for i in range(n):
	tasks.append((h[i], i + 1))
tasks.sort()
swaps = []
for i in range(1, n):
	if len(swaps) >= 2:
		break
	if tasks[i - 1][0] == tasks[i][0]:
		swaps.append((i - 1, i))
if len(swaps) < 2:
	print('NO')
	exit()
print('YES')
print_plan(tasks)
(tasks[swaps[0][0]], tasks[swaps[0][1]]) = (tasks[swaps[0][1]], tasks[swaps[0][0]])
print_plan(tasks)
(tasks[swaps[1][0]], tasks[swaps[1][1]]) = (tasks[swaps[1][1]], tasks[swaps[1][0]])
print_plan(tasks)


n = int(input())
a = sorted([(int(x), y + 1) for (x, y) in zip(input().split(), range(n))])
cnt = 0
for ((x, y), (xx, yy)) in zip(a[:-1], a[1:]):
	if x == xx:
		cnt += 1
if cnt < 2:
	print('NO')
	exit(0)
print('YES')
print(' '.join((str(y) for (x, y) in a)))
i = 0
while a[i][0] != a[i + 1][0]:
	i += 1
(a[i], a[i + 1]) = (a[i + 1], a[i])
print(' '.join((str(y) for (x, y) in a)))
i += 1
while a[i][0] != a[i + 1][0]:
	i += 1
(a[i], a[i + 1]) = (a[i + 1], a[i])
print(' '.join((str(y) for (x, y) in a)))


n = int(input())
l = list(map(int, input().split()))
s = []
for i in range(n):
	x = [l[i], i]
	s.append(x)
s.sort()
flag = 0
sw = []
ans = []
for i in range(n):
	x = s[i][1]
	ans.append(x)
for i in range(n - 1):
	if s[i][0] == s[i + 1][0]:
		sw.append((i, i + 1))
	if len(sw) == 2:
		print('YES')
		flag = 1
		break
if flag == 1:
	for i in range(3):
		for j in range(n):
			print(ans[j] + 1, end=' ')
		print()
		if i != 2:
			(ans[sw[i][0]], ans[sw[i][1]]) = (ans[sw[i][1]], ans[sw[i][0]])
else:
	print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz'
M = 10 ** 9 + 7
EPS = 1e-06

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

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
a = array()
ind = defaultdict(list)
for i in range(n):
	ind[a[i]].append(i + 1)
sorted_a = sorted(set(a))
ans = []
for i in sorted_a:
	ans.extend(ind[i])
permuations = [ans]
cur = 0
for i in sorted_a:
	if len(ind[i]) >= 2 and len(permuations) < 3:
		t = ans[cur:cur + 2]
		ans = ans[:cur] + t[::-1] + ans[cur + 2:]
		permuations.append(ans)
	if len(ind[i]) > 2 and len(permuations) < 3:
		t = ans[cur + 1:cur + 3]
		ans = ans[:cur + 1] + t[::-1] + ans[cur + 3:]
		permuations.append(ans)
		break
	cur += len(ind[i])
if len(permuations) < 3:
	print('NO')
else:
	print('YES')
	for i in permuations:
		print(*i)


n = int(input())
arr = [0] * n
k = 0
for i in list(map(int, input().split())):
	arr[k] = (i, k + 1)
	k += 1
arr.sort()
k = 0
p = ''
ans = 0
ind = []
for i in arr:
	if i[0] == p:
		ans += 1
		ind.append(k)
	else:
		p = i[0]
	if ans > 1:
		break
	k += 1
if len(ind) != 2:
	print('NO')
else:
	print('YES')
	for i in arr:
		print(i[1], end=' ')
	print()
	for i in arr[:ind[0] - 1]:
		print(i[1], end=' ')
	print(arr[ind[0]][1], end=' ')
	print(arr[ind[0] - 1][1], end=' ')
	for i in arr[ind[0] + 1:]:
		print(i[1], end=' ')
	print()
	for i in arr[:ind[1] - 1]:
		print(i[1], end=' ')
	print(arr[ind[1]][1], end=' ')
	print(arr[ind[1] - 1][1], end=' ')
	for i in arr[ind[1] + 1:]:
		print(i[1], end=' ')


n = int(input())
A = list(map(int, input().split()))
F = [0] * 2001
F[0] = 1
for i in range(1, len(F)):
	F[i] = F[i - 1] * i
X = [0] * len(A)
Z = [0] * 2001
for i in range(len(A)):
	X[i] = (A[i], i + 1)
	Z[A[i]] += 1
X.sort()
ans = 1
for elem in Z:
	ans *= F[elem]
if ans < 3:
	print('NO')
else:
	print('YES')
	lal = False
	a = True
	tmp = [X[0][1]]
	ans1 = []
	ans2 = []
	ans3 = []
	i = 1
	while i <= len(X):
		while i < len(X) and X[i][0] == X[i - 1][0]:
			tmp.append(X[i][1])
			i += 1
		if len(tmp) == 1:
			ans1.extend(tmp)
			ans2.extend(tmp)
			ans3.extend(tmp)
		elif len(tmp) == 2 and lal:
			ans1.extend([tmp[0], tmp[1]])
			ans2.extend([tmp[0], tmp[1]])
			ans3.extend([tmp[1], tmp[0]])
			lal = False
		elif len(tmp) == 2:
			ans1.extend([tmp[0], tmp[1]])
			ans2.extend([tmp[1], tmp[0]])
			ans3.extend([tmp[0], tmp[1]])
			lal = True
		elif len(tmp) == 3:
			ans1.extend([tmp[0], tmp[1], tmp[2]])
			ans2.extend([tmp[0], tmp[2], tmp[1]])
			ans3.extend([tmp[1], tmp[0], tmp[2]])
		else:
			ans1.extend([tmp[0], tmp[1], tmp[2]])
			ans1.extend(tmp[3:])
			ans2.extend([tmp[0], tmp[2], tmp[1]])
			ans2.extend(tmp[3:])
			ans3.extend([tmp[1], tmp[0], tmp[2]])
			ans3.extend(tmp[3:])
		if i < len(X):
			tmp = [X[i][1]]
		i += 1
	print(' '.join(map(str, ans1)))
	print(' '.join(map(str, ans2)))
	print(' '.join(map(str, ans3)))


n = int(input())
h = list(map(int, input().split()))
s = sorted(h)
if n - len(set(h)) >= 2:
	print('YES')
	t = []
	for x in sorted(set(h)):
		l = [str(i + 1) for (i, j) in enumerate(h) if j == x]
		t.append(l)
	print(' '.join(sum(t, [])))
	c = 1
	if any((len(a) >= 3 for a in t)):
		for i in range(len(t)):
			if len(t[i]) >= 3:
				t[i] = t[i][1:] + t[i][:1]
				print(' '.join(sum(t, [])))
				t[i] = t[i][1:] + t[i][:1]
				print(' '.join(sum(t, [])))
				break
	else:
		for i in range(len(t)):
			if len(t[i]) == 2:
				t[i] = t[i][::-1]
				print(' '.join(sum(t, [])))
				c += 1
				if c == 3:
					break
else:
	print('NO')


def main():
	n = int(input())
	hh = [(x, i) for (i, x) in zip(range(1, n + 1), map(int, input().split()))]
	hh.sort()
	swaps = []
	for (i, (x, _), (y, _)) in zip(range(n), hh, hh[1:]):
		if x == y:
			swaps.append(i)
			if len(swaps) > 1:
				print('YES')
				l = [i for (_, i) in hh]
				print(*l)
				for i in swaps:
					(l[i], l[i + 1]) = (l[i + 1], l[i])
					print(*l)
				return
	print('NO')
main()


from functools import reduce
from itertools import permutations
from sys import setrecursionlimit
setrecursionlimit(100000)
result = 0

def gen(n, ans=[]):
	global result
	if not n:
		print(*ans)
		result += 1
		return
	if result >= 3:
		return
	for y in permutations(c[-n]):
		gen(n - 1, ans + list(y))
		if result >= 3:
			return
(n, a, c) = (int(input()), list(map(int, input().split())), {})
for i in range(n):
	if a[i] not in c:
		c[a[i]] = []
	c[a[i]].append(i + 1)
c = [c[x] for x in sorted(set(a))]
if reduce(lambda a, b: (a if type(a) == int else len(a)) * (b if type(b) == int else len(b)), c, 1) < 3:
	print('NO')
else:
	print('YES')
	gen(len(c))


n = int(input())
L = list(map(int, input().split()))
for i in range(n):
	L[i] = (L[i], i + 1)
L.sort()
H1 = []
for i in range(n):
	H1.append(L[i][1])
ind = -1
for i in range(1, n):
	if L[i][0] == L[i - 1][0]:
		(L[i], L[i - 1]) = (tuple(L[i - 1]), tuple(L[i]))
		found = True
		ind = i
		break
if ind == -1:
	print('NO')
else:
	H2 = []
	for i in range(n):
		H2.append(L[i][1])
	ind += 1
	found = False
	for i in range(ind, n):
		if L[i][0] == L[i - 1][0]:
			(L[i], L[i - 1]) = (tuple(L[i - 1]), tuple(L[i]))
			found = True
			ind = i
			break
	if not found:
		print('NO')
	else:
		print('YES')
		H3 = []
		for i in range(n):
			H3.append(L[i][1])
		for i in range(n):
			print(H1[i], end=' ')
		print()
		for i in range(n):
			print(H2[i], end=' ')
		print()
		for i in range(n):
			print(H3[i], end=' ')
		print()


(n, inp) = (int(input()), input().split(' '))
dict = [[i, int(inp[i])] for i in range(n)]
dict.sort(key=lambda i: i[1])
val = [i[1] for i in dict]
f = [i[0] + 1 for i in dict]
i = p = 0
if len(val) - len(set(val)) < 2:
	print('NO')
else:
	print('YES')
	print(' '.join(map(str, f)))
	for i in range(n):
		if val[i:].count(val[i]) >= 2:
			if p == 0:
				s = f[:]
				(s[i], s[i + 1]) = (s[i + 1], s[i])
				p = 1
				print(' '.join(map(str, s)))
			else:
				t = s[:]
				(t[i], t[i + 1]) = (t[i + 1], t[i])
				print(' '.join(map(str, t)))
				break


N = int(input())
L = list(map(int, input().split(' ')))
D = {}
state = 0
for i in L:
	if i in D:
		state += 1
	else:
		D[i] = 1
if state < 2:
	print('NO')
else:
	print('YES')
	res1 = ''
	res2 = ''
	res3 = ''
	K = [[L[i], i] for i in range(len(L))]
	K.sort(key=lambda x: x[0])
	for i in K:
		res1 += str(i[1] + 1) + ' '
	for i in range(len(K) - 1):
		if K[i][0] == K[i + 1][0]:
			(K[i][1], K[i + 1][1]) = (K[i + 1][1], K[i][1])
			if res2 == '':
				for j in K:
					res2 += str(j[1] + 1) + ' '
			elif res3 == '':
				for j in K:
					res3 += str(j[1] + 1) + ' '
		if res3 != '':
			break
	print(res1)
	print(res2)
	print(res3)


n = int(input())
x = list(map(int, input().split()))
d = dict()
cnt = []
store = [[] for i in range(2000 + 1)]
for i in range(len(x)):
	if x[i] not in d:
		d[x[i]] = len(d)
		cnt.append(1)
	else:
		cnt[d[x[i]]] += 1
	store[x[i]].append(i + 1)
times = 1
for i in cnt:
	times = times * i
if times >= 3:
	print('YES')
	task1 = []
	temp = []
	for i in range(len(store)):
		if len(store[i]) != 0:
			temp.append([])
			for j in range(len(store[i])):
				temp[-1].append(len(task1))
				task1.append(store[i][j])
	for i in range(len(task1)):
		print(task1[i], end=' ')
	print()
	cnt = 0
	res = []
	for i in range(len(temp)):
		if len(temp[i]) > 1 and len(res) < 2:
			for j in range(len(temp[i]) - 1):
				tmp = task1[:]
				(tmp[temp[i][j]], tmp[temp[i][j + 1]]) = (tmp[temp[i][j + 1]], tmp[temp[i][j]])
				res.append(tmp)
				if len(res) >= 2:
					break
	for i in range(2):
		for j in res[i]:
			print(j, end=' ')
		print()
else:
	print('NO')


def main():
	n = int(input())
	x = [[int(y), 0] for y in input().split()]
	solucion = []
	for i in range(len(x)):
		x[i][1] = i + 1
	x.sort()
	solucion.append(x)
	for i in range(len(x)):
		if i + 1 < n and x[i][0] == x[i + 1][0]:
			(x[i + 1], x[i]) = (x[i], x[i + 1])
			solucion.append([z for z in x])
			(x[i], x[i + 1]) = (x[i + 1], x[i])
			if len(solucion) == 3:
				break
	if len(solucion) == 3:
		print('YES')
		for i in range(3):
			for j in range(len(x) - 1):
				print(solucion[i][j][1], end=' ')
			print(solucion[i][len(x) - 1][1])
	else:
		print('NO')
main()


n = int(input())
task = list(map(int, input().split()))
for i in range(n):
	task[i] = (task[i], i + 1)
swapCnt = 0
task.sort()
for i in range(n - 1):
	if task[i][0] == task[i + 1][0]:
		if swapCnt == 0:
			sol1 = task.copy()
			(sol1[i], sol1[i + 1]) = (sol1[i + 1], sol1[i])
		else:
			sol2 = task.copy()
			(sol2[i], sol2[i + 1]) = (sol2[i + 1], sol2[i])
		swapCnt += 1
	if swapCnt > 1:
		break
if swapCnt > 1:
	print('YES')
	for x in task:
		print(x[1], end=' ')
	print()
	for x in sol1:
		print(x[1], end=' ')
	print()
	for x in sol2:
		print(x[1], end=' ')
else:
	print('NO')


class Pair:

	def __init__(self, id, difficult):
		self.id = id
		self.difficult = difficult

	def __lt__(self, other):
		return self.difficult < other.difficult

def printPair(pairs):
	tmp_a = []
	for i in range(len(pairs)):
		tmp_a.append(int(pairs[i].id) + 1)
	return ' '.join((str(x) for x in tmp_a))
try:
	n = int(input())
	a = list(map(int, input().split()))
	a_p = []
	for i in range(n):
		a_p.append(Pair(i, a[i]))
	a_p.sort()
	c = 0
	for i in range(n - 1):
		if a_p[i].difficult == a_p[i + 1].difficult:
			c += 1
	if c >= 2:
		print('YES')
		print(printPair(a_p))
		c = 0
		for j in range(n - 1):
			if a_p[j].difficult == a_p[j + 1].difficult:
				c += 1
				(a_p[j + 1], a_p[j]) = (a_p[j], a_p[j + 1])
				print(printPair(a_p))
				(a_p[j], a_p[j + 1]) = (a_p[j + 1], a_p[j])
			if c == 2:
				break
	else:
		print('NO')
except EOFError:
	sys.exit(0)


n = int(input())
D = list(map(int, input().split()))
A = []
for i in range(n):
	A.append(i + 1)
for i in range(n):
	for j in range(n - 1):
		if D[j] > D[j + 1]:
			t = D[j]
			D[j] = D[j + 1]
			D[j + 1] = t
			t1 = A[j]
			A[j] = A[j + 1]
			A[j + 1] = t1
D.append(0)
c = 0
M = A[:]
U = A[:]
H = A[:]
for i in range(n - 1):
	if D[i] == D[i + 1]:
		if c == 1:
			t = H[i]
			H[i] = H[i + 1]
			H[i + 1] = t
			c = c + 1
			break
		t = M[i]
		M[i] = M[i + 1]
		M[i + 1] = t
		c = c + 1
		if D[i] == D[i + 2]:
			t = H[i + 1]
			H[i + 1] = H[i + 2]
			H[i + 2] = t
			c = c + 1
			break
if c == 2:
	print('YES')
	M1 = [str(a) for a in M]
	print(' '.join(M1))
	U1 = [str(a) for a in U]
	print(' '.join(U1))
	H1 = [str(a) for a in H]
	print(' '.join(H1))
else:
	print('NO')


n = int(input())
h = [int(x) for x in input().split()]
sh = sorted(((x, i + 1) for (i, x) in enumerate(h)))
val = [[], [], []]
(i, cur) = (0, 0)
while i < n:
	if i < n - 2 and cur == 0 and (sh[i][0] == sh[i + 1][0]) and (sh[i + 1][0] == sh[i + 2][0]):
		val[0].extend((sh[i][1], sh[i + 1][1], sh[i + 2][1]))
		val[1].extend((sh[i + 1][1], sh[i][1], sh[i + 2][1]))
		val[2].extend((sh[i][1], sh[i + 2][1], sh[i + 1][1]))
		cur = 2
		i += 3
	elif i < n - 1 and cur < 2 and (sh[i][0] == sh[i + 1][0]):
		val[cur].extend((sh[i][1], sh[i + 1][1]))
		val[cur + 1].extend((sh[i + 1][1], sh[i][1]))
		val[(cur + 2) % 3].extend((sh[i][1], sh[i + 1][1]))
		cur += 1
		i += 2
	else:
		for l in val:
			l.append(sh[i][1])
		i += 1
if cur == 2:
	print('YES')
	for l in val:
		print(' '.join(map(str, l)))
else:
	print('NO')


n = int(input())
m = list(map(int, input().split()))
u = {}
for (i, v) in enumerate(m):
	if not v in u:
		u[v] = []
	u[v].append(i + 1)
d = []
for i in u:
	m1 = u[i]
	d.append([i, m1, len(m1)])
d = sorted(d, key=lambda x: x[0])
pos = 1
s1 = []
s2 = []
s3 = []
for val in d:
	l = val[1]
	if pos != 3:
		if val[2] == 2:
			if pos == 1:
				pos = 2
				s1 += l
				s3 += l
				l.reverse()
				s2 += l
				continue
			elif pos == 2:
				pos = 3
				s1 += l
				s2 += l
				l.reverse()
				s3 += l
				continue
		elif val[2] > 2:
			pos = 3
			s1 += l
			l.reverse()
			s2 += l
			(l[1], l[2]) = (l[2], l[1])
			s3 += l
			continue
	s1 += l
	s2 += l
	s3 += l
if pos == 3:
	print('YES')
	print(' '.join(map(str, s1)))
	print(' '.join(map(str, s2)))
	print(' '.join(map(str, s3)))
else:
	print('NO')