题干:

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 ntasks 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 ndistinct 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.

题目大意:

   给定n个任务,每个任务有一个难度值,现在要你输出一个完成任务的三种序列,要求有二:1.如果难度值不同的话先完成难度值低的,难度值相同的任务先完成哪个都行。

解题报告:

   很简单的模拟题啊但是写挂好多次,,难受难受、、、其实这题要想代码短一点,,上来就排序就完事了,然后扫一遍看前后两个值相同的个数是否大于等于两个  如果小于两个输出NO 大于等于两个就取前两个然后乱搞。

AC代码:(冗长的代码不想再读第二遍)

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
int bk[MAX];
int a[MAX];
int n;
int c2,c3;
struct Node {
	int dif,pos;
} node[MAX];
bool cmp(Node a,Node b) {
	return a.dif<b.dif;
}
int main()
{
	cin>>n;
	for(int i = 1; i<=n; i++) scanf("%d",a+i),bk[a[i]]++,node[i].dif=a[i],node[i].pos=i;
	for(int i = 1; i<=2000; i++) {
		if(bk[i] >= 3) c3++,c2++;
		if(bk[i] >= 2) c2++;
	}
	if(c3==0 && c2<=1) {
		puts("NO");return 0 ;
	}
	sort(node+1,node+n+1,cmp);
	puts("YES");
	if(c3 >= 1) {
		for(int i = 1; i<=2000; i++) {
			if(bk[i] >= 3) {
				c3=i;break;
			}
		}
		for(int i = 1,flag=0; i<=n;) {
			if(node[i].dif == c3 && flag == 0) {
				printf("%d %d %d ",node[i].pos,node[i+1].pos,node[i+2].pos);i+=3;flag=1;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}
		puts("");
		for(int i = 1,flag=0; i<=n;) {
			if(node[i].dif == c3 && flag == 0) {
				printf("%d %d %d ",node[i+1].pos,node[i].pos,node[i+2].pos);i+=3;flag=1;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}
		puts("");
		for(int i = 1,flag=0; i<=n;) {
			if(node[i].dif == c3 && flag == 0) {
				printf("%d %d %d ",node[i+2].pos,node[i+1].pos,node[i].pos);i+=3;flag=1;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}		
	}
	else {
		int tot=0,c[4]={0};
		for(int i = 1; i<=2000; i++) {
			if(bk[i] == 2) c[++tot] = i;
			if(tot==2) break;
		}
		for(int i = 1; i<=n;) {
			if(node[i].dif == c[1]) {
				printf("%d %d ",node[i].pos,node[i+1].pos);i+=2;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}
		puts(""); 
		for(int i = 1; i<=n;) {
			if(node[i].dif == c[2]) {
				printf("%d %d ",node[i+1].pos,node[i].pos);i+=2;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}
		puts("");
		for(int i = 1; i<=n;) {
			if(node[i].dif == c[1]) {
				printf("%d %d ",node[i+1].pos,node[i].pos);i+=2;
			}
			else {
				printf("%d ",node[i].pos);i++;
			}
		}		
	}
	return 0 ;
 }

总结:

   注意那个flag那个地方必须要有啊,不然比如n=10然后给你十个1,,,你就很难受了,,会发现多输出了两个数。