#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define MP(X,Y) make_pair(X,Y)
#define SORT(X) (sort(X.begin(),X.end()))
#define SORTC(X,Y) (sort(X.begin(),X.end(),Y))
#define PUSH(X,Y) (X.push_back(Y))
#define two(X) (1<<(X))
#define twoL(X) (((LL)(1))<<(X))
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FR(i , n) FOR(i , 0 , n)
#define BAK(i, n, a) for(int i = (n); i >= (a); i--)
#define BK(i , n) BAK(i , n , 0)
#define MS(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int) (x).size())
#define RI(x) scanf("%d", &x)
#define RII(x,y) scanf("%d %d", &x, &y)
#define RIII(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define RS(x) getline(cin,x)
#define PI(x) printf("%d\n", x)
#define PIG(x) printf("%d ", x)
#define PII(x,y) printf("%d %d\n",x,y)
#define PIIG(x,y) printf("%d %d ",x,y)
#define PL(x) cout<<x<<"\n"
#define PLG(x) cout<<x<<" "
#define PLL(x,y) cout<<x<<" "<<y<<"\n"
#define PLLG(x,y) cout<<x<<" "<<y<<" "
#define PS(x) cout<<x<<"\n"
#define PSG(x) cout<<x<<" "

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<pii> vpii;

template<class T> inline T sqr(T x){return x*x;} //square

template<class T> inline T gcd(T a,T b) //gcd
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

template<class T> inline T absval(T a) //absolute value
  {if(a<0)return -a;else return a;}

//from string to int
int toInt(string s){istringstream iss(s);int res;if(!(iss>>res))res = -1;return res;}
//from int to string
string toString(int a){ostringstream oss;oss<<a;return oss.str();}
//extracting tokens from string, delim is the delimiter
vector<string> getTokens(string s,char delim){vector<string> tokens;istringstream iss(s);string temp;while(getline(iss,temp,delim)){tokens.push_back(temp);}return tokens;}

const int MaxMatrixSize = 1000;//MaxMatrixSize
template<class T> inline void printMat(int n,T A[MaxMatrixSize][MaxMatrixSize]) //for printing matrix
  {for (int i=0;i<n;i++){for (int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}}

template<class T> inline void printVec(vector<T> A) //for printing matrix
  {for (int i=0;i<A.size();i++){cout<<A[i]<<" ";}}

//distance between 2 points
double dist(double x1,double y1,double x2,double y2){return sqrt(sqr(x1-x2)+sqr(y1-y2));}
//square of distance between 2 points
double distR(double x1,double y1,double x2,double y2){return sqr(x1-x2)+sqr(y1-y2);}

//FOR COMPARISON BASED SORTING
class Compare {
private:
    vi a;
public:
    Compare(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<a[j-1])
            return true;
        return false;
    }
};

class Compares {
private:
    vi a;
public:
    Compares(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<=a[j-1])
            return true;
        return false;
    }
};

//MAIN TASK SOLVING CLASS
class Codeforces {
public:
    void task(vi a, int n) {
        int d[2003] = {0};
        int count = 0;
        bool flag = false;

        FR(i,n) {
            d[a[i]]++;
        }

        int e = 0;
        FR(i,2003) {
            if(d[i]>=3) {
                flag = true;
                e = i;
                break;
            } else if(d[i]==2) {
                count++;
                if(count==2) {
                    flag = true;
                    e = i;
                    break;
                }
            }
        }

        if(!flag) {
            cout<<"NO\n";
            return;
        }

        cout<<"YES\n";
        vi g;
        FR(i,n) {
            g.push_back(i+1);
        }

        Compare comp = Compare(a);
        Compares comps = Compares(a);

        SORTC(g,comp);
        printVec(g);
        cout<<"\n";

        count = 0;
        FR(i,n) {
            if(i+1<n && a[g[i]-1]==a[g[i+1]-1]) {
                int t = g[i];
                g[i] = g[i+1];
                g[i+1] = t;
                printVec(g);
                cout<<"\n";
                count++;
                if(count==2)
                    break;
                continue;
            }
        }

        return;
    }
};

//MAIN
int main() {

    Codeforces cf = Codeforces();
    int n = 50;
    RI(n);
    vi a;
    a.resize(n);
    FR(i,n) {
        RI(a[i]);
        //a[i] = 1449;
    }
    cf.task(a,n);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define MP(X,Y) make_pair(X,Y)
#define SORT(X) (sort(X.begin(),X.end()))
#define SORTC(X,Y) (sort(X.begin(),X.end(),Y))
#define PUSH(X,Y) (X.push_back(Y))
#define two(X) (1<<(X))
#define twoL(X) (((LL)(1))<<(X))
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FR(i , n) FOR(i , 0 , n)
#define BAK(i, n, a) for(int i = (n); i >= (a); i--)
#define BK(i , n) BAK(i , n , 0)
#define MS(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int) (x).size())
#define RI(x) scanf("%d", &x)
#define RII(x,y) scanf("%d %d", &x, &y)
#define RIII(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define RS(x) getline(cin,x)
#define PI(x) printf("%d\n", x)
#define PIG(x) printf("%d ", x)
#define PII(x,y) printf("%d %d\n",x,y)
#define PIIG(x,y) printf("%d %d ",x,y)
#define PL(x) cout<<x<<"\n"
#define PLG(x) cout<<x<<" "
#define PLL(x,y) cout<<x<<" "<<y<<"\n"
#define PLLG(x,y) cout<<x<<" "<<y<<" "
#define PS(x) cout<<x<<"\n"
#define PSG(x) cout<<x<<" "

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<pii> vpii;

template<class T> inline T sqr(T x){return x*x;} //square

template<class T> inline T gcd(T a,T b) //gcd
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

template<class T> inline T absval(T a) //absolute value
  {if(a<0)return -a;else return a;}

//from string to int
int toInt(string s){istringstream iss(s);int res;if(!(iss>>res))res = -1;return res;}
//from int to string
string toString(int a){ostringstream oss;oss<<a;return oss.str();}
//extracting tokens from string, delim is the delimiter
vector<string> getTokens(string s,char delim){vector<string> tokens;istringstream iss(s);string temp;while(getline(iss,temp,delim)){tokens.push_back(temp);}return tokens;}

const int MaxMatrixSize = 1000;//MaxMatrixSize
template<class T> inline void printMat(int n,T A[MaxMatrixSize][MaxMatrixSize]) //for printing matrix
  {for (int i=0;i<n;i++){for (int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}}

template<class T> inline void printVec(vector<T> A) //for printing matrix
  {for (int i=0;i<A.size();i++){cout<<A[i]<<" ";}}

//distance between 2 points
double dist(double x1,double y1,double x2,double y2){return sqrt(sqr(x1-x2)+sqr(y1-y2));}
//square of distance between 2 points
double distR(double x1,double y1,double x2,double y2){return sqr(x1-x2)+sqr(y1-y2);}

//FOR COMPARISON BASED SORTING
class Compare {
private:
    vi a;
public:
    Compare(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<a[j-1])
            return true;
        return false;
    }
};

class Compares {
private:
    vi a;
public:
    Compares(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<=a[j-1])
            return true;
        return false;
    }
};

//MAIN TASK SOLVING CLASS
class Codeforces {
public:
    void task(vi a, int n) {
        int d[2003] = {0};
        int count = 0;
        bool flag = false;

        FR(i,n) {
            d[a[i]]++;
        }

        FR(i,2003) {
            if(d[i]>=3) {
                flag = true;
                break;
            } else if(d[i]==2) {
                count++;
                if(count==2) {
                    flag = true;
                    break;
                }
            }
        }

        if(!flag) {
            cout<<"NO\n";
            return;
        }

        cout<<"YES\n";
        vi g;
        FR(i,n) {
            g.push_back(i+1);
        }

        vi f = g;
        Compare comp = Compare(a);
        Compares comps = Compares(a);

        SORTC(f,comp);

        vi s = f;
        int lim = d[a[s[0]-1]];
        for(int i=0;i<lim/2;i++) {
            int t = s[i];
            s[i] = s[lim-i-1];
            s[lim-i-1] = t;
        }
        printVec(s);
        cout<<"\n";

        printVec(f);
        cout<<"\n";

        SORTC(g,comps);
        printVec(g);
        cout<<"\n";

        return;
    }
};

//MAIN
int main() {

    Codeforces cf = Codeforces();
    int n;
    RI(n);
    vi a;
    a.resize(n);
    FR(i,n) {
        RI(a[i]);
    }
    cf.task(a,n);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define MP(X,Y) make_pair(X,Y)
#define SORT(X) (sort(X.begin(),X.end()))
#define SORTC(X,Y) (sort(X.begin(),X.end(),Y))
#define PUSH(X,Y) (X.push_back(Y))
#define two(X) (1<<(X))
#define twoL(X) (((LL)(1))<<(X))
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FR(i , n) FOR(i , 0 , n)
#define BAK(i, n, a) for(int i = (n); i >= (a); i--)
#define BK(i , n) BAK(i , n , 0)
#define MS(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int) (x).size())
#define RI(x) scanf("%d", &x)
#define RII(x,y) scanf("%d %d", &x, &y)
#define RIII(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define RS(x) getline(cin,x)
#define PI(x) printf("%d\n", x)
#define PIG(x) printf("%d ", x)
#define PII(x,y) printf("%d %d\n",x,y)
#define PIIG(x,y) printf("%d %d ",x,y)
#define PL(x) cout<<x<<"\n"
#define PLG(x) cout<<x<<" "
#define PLL(x,y) cout<<x<<" "<<y<<"\n"
#define PLLG(x,y) cout<<x<<" "<<y<<" "
#define PS(x) cout<<x<<"\n"
#define PSG(x) cout<<x<<" "

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<pii> vpii;

template<class T> inline T sqr(T x){return x*x;} //square

template<class T> inline T gcd(T a,T b) //gcd
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

template<class T> inline T absval(T a) //absolute value
  {if(a<0)return -a;else return a;}

//from string to int
int toInt(string s){istringstream iss(s);int res;if(!(iss>>res))res = -1;return res;}
//from int to string
string toString(int a){ostringstream oss;oss<<a;return oss.str();}
//extracting tokens from string, delim is the delimiter
vector<string> getTokens(string s,char delim){vector<string> tokens;istringstream iss(s);string temp;while(getline(iss,temp,delim)){tokens.push_back(temp);}return tokens;}

const int MaxMatrixSize = 1000;//MaxMatrixSize
template<class T> inline void printMat(int n,T A[MaxMatrixSize][MaxMatrixSize]) //for printing matrix
  {for (int i=0;i<n;i++){for (int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}}

template<class T> inline void printVec(vector<T> A) //for printing matrix
  {for (int i=0;i<A.size();i++){cout<<A[i]<<" ";}}

//distance between 2 points
double dist(double x1,double y1,double x2,double y2){return sqrt(sqr(x1-x2)+sqr(y1-y2));}
//square of distance between 2 points
double distR(double x1,double y1,double x2,double y2){return sqr(x1-x2)+sqr(y1-y2);}

//FOR COMPARISON BASED SORTING
class Compare {
private:
    vi a;
public:
    Compare(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<a[j-1])
            return true;
        return false;
    }
};

class Compares {
private:
    vi a;
public:
    Compares(vi a_):
    a(a_)
    {}

    bool operator()(int i, int j) {
        if(a[i-1]<=a[j-1])
            return true;
        return false;
    }
};

//MAIN TASK SOLVING CLASS
class Codeforces {
public:
    void task(vi a, int n) {
        int d[2003] = {0};
        int count = 0;
        bool flag = false;

        FR(i,n) {
            d[a[i]]++;
        }

        int e = 0;
        FR(i,2003) {
            if(d[i]>=3) {
                flag = true;
                e = i;
                break;
            } else if(d[i]==2) {
                count++;
                if(count==2) {
                    flag = true;
                    e = i;
                    break;
                }
            }
        }

        if(!flag) {
            cout<<"NO\n";
            return;
        }

        cout<<"YES\n";
        vi g;
        FR(i,n) {
            g.push_back(i+1);
        }

        vi f = g;
        Compare comp = Compare(a);
        Compares comps = Compares(a);

        SORTC(f,comp);
        printVec(f);
        cout<<"\n";

        SORTC(g,comps);
        printVec(g);
        cout<<"\n";

        FR(i,n) {
            if(i+1<n && a[g[i]-1]==a[g[i+1]-1]) {
                int t = g[i];
                g[i] = g[i+1];
                g[i+1] = t;
                break;
            }
        }
        printVec(g);
        cout<<"\n";

        return;
    }
};

//MAIN
int main() {

    Codeforces cf = Codeforces();
    int n;
    RI(n);
    vi a;
    a.resize(n);
    FR(i,n) {
        RI(a[i]);
    }
    cf.task(a,n);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define MP(X,Y) make_pair(X,Y)
#define SORT(X) (sort(X.begin(),X.end()))
#define SORTC(X,Y) (sort(X.begin(),X.end(),Y))
#define PUSH(X,Y) (X.push_back(Y))
#define two(X) (1<<(X))
#define twoL(X) (((LL)(1))<<(X))
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FR(i , n) FOR(i , 0 , n)
#define BAK(i, n, a) for(int i = (n); i >= (a); i--)
#define BK(i , n) BAK(i , n , 0)
#define MS(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int) (x).size())
#define RI(x) scanf("%d", &x)
#define RII(x,y) scanf("%d %d", &x, &y)
#define RIII(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define RS(x) getline(cin,x)
#define PI(x) printf("%d\n", x)
#define PIG(x) printf("%d ", x)
#define PII(x,y) printf("%d %d\n",x,y)
#define PIIG(x,y) printf("%d %d ",x,y)
#define PL(x) cout<<x<<"\n"
#define PLG(x) cout<<x<<" "
#define PLL(x,y) cout<<x<<" "<<y<<"\n"
#define PLLG(x,y) cout<<x<<" "<<y<<" "
#define PS(x) cout<<x<<"\n"
#define PSG(x) cout<<x<<" "

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<pii> vpii;

template<class T> inline T sqr(T x){return x*x;} //square

template<class T> inline T gcd(T a,T b) //gcd
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

template<class T> inline T absval(T a) //absolute value
  {if(a<0)return -a;else return a;}

//from string to int
int toInt(string s){istringstream iss(s);int res;if(!(iss>>res))res = -1;return res;}
//from int to string
string toString(int a){ostringstream oss;oss<<a;return oss.str();}
//extracting tokens from string, delim is the delimiter
vector<string> getTokens(string s,char delim){vector<string> tokens;istringstream iss(s);string temp;while(getline(iss,temp,delim)){tokens.push_back(temp);}return tokens;}

const int MaxMatrixSize = 1000;//MaxMatrixSize
template<class T> inline void printMat(int n,T A[MaxMatrixSize][MaxMatrixSize]) //for printing matrix
  {for (int i=0;i<n;i++){for (int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}}

template<class T> inline void printVec(vector<T> A) //for printing matrix
  {for (int i=0;i<A.size();i++){cout<<A[i]<<" ";}}

//distance between 2 points
double dist(double x1,double y1,double x2,double y2){return sqrt(sqr(x1-x2)+sqr(y1-y2));}
//square of distance between 2 points
double distR(double x1,double y1,double x2,double y2){return sqr(x1-x2)+sqr(y1-y2);}

//FOR COMPARISON BASED SORTING
class Compare {
public:
    vi a;
    bool operator()(int i, int j) {
        if(a[i]<a[j])
            return true;
        return false;
    }
};

class Compares {
public:
    vi a;
    bool operator()(int i, int j) {
        if(a[i]<=a[j])
            return true;
        return false;
    }
};

//MAIN TASK SOLVING CLASS
class Codeforces {
public:
    void task(vi a, int n) {
        int d[2003] = {0};
        int count = 0;
        bool flag = false;

        FR(i,n) {
            d[a[i]]++;
        }

        FR(i,2003) {
            if(d[i]>=3) {
                flag = true;
                break;
            } else if(d[i]==2) {
                count++;
                if(count==2) {
                    flag = true;
                    break;
                }
            }
        }

        if(!flag) {
            cout<<"NO\n";
            return;
        }

        cout<<"YES\n";
        vi g;
        FR(i,n) {
            g.push_back(i+1);
        }

        vi f = g;

        Compare comp = Compare();
        Compares comps = Compares();
        SORT(a);

        comp.a = a;
        comps.a = a;

        SORTC(f,comp);
        printVec(f);
        cout<<"\n";

        SORTC(g,comps);
        printVec(g);
        cout<<"\n";

        int lim = d[a[g[0]-1]];
        for(int i=0;i<lim/2;i++) {
            int t = g[i];
            g[i] = g[lim-i-1];
            g[lim-i-1] = t;
        }
        printVec(g);
        cout<<"\n";

        return;
    }
};

//MAIN
int main() {

    Codeforces cf = Codeforces();
    int n;
    RI(n);
    vi a;
    a.resize(n);
    FR(i,n) {
        RI(a[i]);
    }
    cf.task(a,n);
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define MP(X,Y) make_pair(X,Y)
#define SORT(X) (sort(X.begin(),X.end()))
#define SORTC(X,Y) (sort(X.begin(),X.end(),Y))
#define PUSH(X,Y) (X.push_back(Y))
#define two(X) (1<<(X))
#define twoL(X) (((LL)(1))<<(X))
#define FOR(i, a, n) for(int i = (a); i < (n); i++)
#define FR(i , n) FOR(i , 0 , n)
#define BAK(i, n, a) for(int i = (n); i >= (a); i--)
#define BK(i , n) BAK(i , n , 0)
#define MS(x, y) memset(x, y, sizeof(x))
#define SZ(x) ((int) (x).size())
#define RI(x) scanf("%d", &x)
#define RII(x,y) scanf("%d %d", &x, &y)
#define RIII(x,y,z) scanf("%d %d %d", &x, &y, &z)
#define RS(x) getline(cin,x)
#define PI(x) printf("%d\n", x)
#define PIG(x) printf("%d ", x)
#define PII(x,y) printf("%d %d\n",x,y)
#define PIIG(x,y) printf("%d %d ",x,y)
#define PL(x) cout<<x<<"\n"
#define PLG(x) cout<<x<<" "
#define PLL(x,y) cout<<x<<" "<<y<<"\n"
#define PLLG(x,y) cout<<x<<" "<<y<<" "
#define PS(x) cout<<x<<"\n"
#define PSG(x) cout<<x<<" "

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<pii> vpii;

template<class T> inline T sqr(T x){return x*x;} //square

template<class T> inline T gcd(T a,T b) //gcd
  {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}

template<class T> inline T absval(T a) //absolute value
  {if(a<0)return -a;else return a;}

//from string to int
int toInt(string s){istringstream iss(s);int res;if(!(iss>>res))res = -1;return res;}
//from int to string
string toString(int a){ostringstream oss;oss<<a;return oss.str();}
//extracting tokens from string, delim is the delimiter
vector<string> getTokens(string s,char delim){vector<string> tokens;istringstream iss(s);string temp;while(getline(iss,temp,delim)){tokens.push_back(temp);}return tokens;}

const int MaxMatrixSize = 1000;//MaxMatrixSize
template<class T> inline void printMat(int n,T A[MaxMatrixSize][MaxMatrixSize]) //for printing matrix
  {for (int i=0;i<n;i++){for (int j=0;j<n;j++)cout<<A[i][j]<<" ";cout<<endl;}}

template<class T> inline void printVec(vector<T> A) //for printing matrix
  {for (int i=0;i<A.size();i++){cout<<A[i]<<" ";}}

//distance between 2 points
double dist(double x1,double y1,double x2,double y2){return sqrt(sqr(x1-x2)+sqr(y1-y2));}
//square of distance between 2 points
double distR(double x1,double y1,double x2,double y2){return sqr(x1-x2)+sqr(y1-y2);}

//FOR COMPARISON BASED SORTING
class Compare {
public:
    vi a;
    bool operator()(int i, int j) {
        if(a[i]<a[j])
            return true;
        return false;
    }
};

class Compares {
public:
    vi a;
    bool operator()(int i, int j) {
        if(a[i]<=a[j])
            return true;
        return false;
    }
};

//MAIN TASK SOLVING CLASS
class Codeforces {
public:
    void task(vi a, int n) {
        int d[2003] = {0};
        int count = 0;
        bool flag = false;

        FR(i,n) {
            d[a[i]]++;
        }

        FR(i,2003) {
            if(d[i]>=3) {
                flag = true;
                break;
            } else if(d[i]==2) {
                count++;
                if(count==2) {
                    flag = true;
                    break;
                }
            }
        }

        if(!flag) {
            cout<<"NO\n";
            return;
        }

        cout<<"YES\n";
        vi g;
        FR(i,n) {
            g.push_back(i+1);
        }

        vi f = g;

        Compare comp = Compare();
        Compares comps = Compares();
        SORT(a);

        comp.a = a;
        comps.a = a;

        SORTC(f,comp);

        vi s = f;
        int lim = d[a[s[0]-1]];
        for(int i=0;i<lim/2;i++) {
            int t = s[i];
            s[i] = s[lim-i-1];
            s[lim-i-1] = t;
        }
        printVec(s);
        cout<<"\n";

        printVec(f);
        cout<<"\n";

        SORTC(g,comps);
        printVec(g);
        cout<<"\n";

        return;
    }
};

//MAIN
int main() {

    Codeforces cf = Codeforces();
    int n;
    RI(n);
    vi a;
    a.resize(n);
    FR(i,n) {
        RI(a[i]);
    }
    cf.task(a,n);
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;
typedef pair<int, int> pii;
#define mp make_pair

bool comp(pii a, pii b) {
    return a.first < b.first;
}

int linecount = 0;
vector<int> ans;
int N;

void dfs(vector<pii> &v, int pos = 0) {
    if (linecount >= 3) return;
    int cont = 0;
    for(int i = pos; v[i].first == v[pos].first && i < N; i++) {
        cont++;
    }
    for(int i = pos; i < cont + pos; i++) {
        for(int j = pos; j < cont + pos; j++) {
            if (i != j) ans.push_back(v[j].second);
        }
        ans.push_back(v[i].second);
        if ((int)ans.size() != N) {
            dfs(v, pos + cont);
        } else {
            for(int j = 0; j < N; j++) {
                cout << ans[j] << " ";
            }
            cout << endl;
            linecount++;
        }
        for(int j = 0; j < cont; j++) {
            ans.pop_back();
        }
        if (linecount >= 3) return;
    }

}

int main() {
    cin >> N;
    vector<pii> v;
    int bac[2001];
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        v.push_back(mp(temp, i + 1));
        bac[temp]++;
    }

    int possible_pre = 0;
    int possible = 0;
    for(int i = 0; i <= 2000; i++) {
        if (possible_pre && bac[i] == 2) possible = 1;
        if (bac[i] == 2) possible_pre = 1;
        if (bac[i] >= 3) possible = 1;
    }

    if (possible) {
        cout << "YES" << endl;
        sort(v.begin(), v.end(), comp);
        dfs(v);
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;
typedef pair<int, int> pii;
#define mp make_pair

bool comp(pii a, pii b) {
    if (a.first < b.first) return false;
    if (a.first > b.first) return true;
    return (rand() % 2) ? true : false;
}
void CombSort(vector<pii> &array, int size){
    int h = size;
    bool is_swapped = false;
    int i;
    pii temp;

    while(h > 1 || is_swapped){
        if(h > 1){
            h = (h*10)/13;
        }

        is_swapped = false;
        for(i = 0; i < size-h; ++i){
            if(comp(array[i],array[i+h]) ){
                //swap
                temp = array[i];
                array[i] = array[i+h];
                array[i+h] = temp;
                is_swapped = true;
            }
        }
    }
}

int main() {
    int N;
    cin >> N;
    vector<pii> v;
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        v.push_back(mp(temp, i + 1));
    }

    CombSort(v, v.size());

    int cont = 0;
    int prev = 0;
    int f = 0;
    int count = 0;
    for(int i = 0; i < N; i++) {
        if (v[i].first == prev) {
            cont++;
        } else {
            cont = 0;
        }
        prev = v[i].first;
        if (cont == 2) {f = 1;}
        if (cont == 1) {count++;}
        if (count >= 2) {f = 1;}
    }

    if (f) {
        int c = 0;
        cout << "YES" << endl;
        int arr[3][2000] = {0};
        while(c < 3) {
            CombSort(v, v.size());

            int ok = 1;
            for(int i = 0; i < c; i++) {
                int flag = 0;
                for(int j = 0; j < N; j++) {
                    if (arr[i][j] != v[j].second) {
                        flag = 1;
                    }
                }
                ok &= flag;
            }
            if (ok) {
                for(int j = 0; j < N; j++) {
                    arr[c][j] = v[j].second;
                    cout << v[j].second << " ";
                }
                cout << endl;
                c++;
            }
        }
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>

using namespace std;
typedef pair<int, int> pii;
#define mp make_pair

bool comp(pii a, pii b) {
    return a.first < b.first;
}

int linecount = 0;
vector<int> ans;
int N;

void dfs(vector<pii> &v, int pos = 0) {
    if (linecount >= 3) return;
    int cont = 0;
    for(int i = pos; v[i].first == v[pos].first && i < N; i++) {
        cont++;
    }
    for(int i = pos; i < cont + pos; i++) {
        for(int j = pos; j < cont + pos; j++) {
            if (i != j) ans.push_back(v[j].second);
        }
        ans.push_back(v[i].second);
        if ((int)ans.size() != N) {
            dfs(v, pos + cont);
        } else {
            for(int j = 0; j < N; j++) {
                cout << ans[j] << " ";
            }
            cout << endl;
            linecount++;
        }
        for(int j = 0; j < cont; j++) {
            ans.pop_back();
        }
        if (linecount >= 3) return;
    }

}

int main() {
    cin >> N;
    vector<pii> v;
    int bac[2001] = {0};
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        v.push_back(mp(temp, i + 1));
        bac[temp]++;
    }

    int possible_pre = 0;
    int possible = 0;
    for(int i = 0; i <= 2000; i++) {
        if (possible_pre && bac[i] == 2) possible = 1;
        if (bac[i] == 2) possible_pre = 1;
        if (bac[i] >= 3) possible = 1;
    }

    if (possible) {
        cout << "YES" << endl;
        sort(v.begin(), v.end(), comp);
        dfs(v);
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <random>

using namespace std;
typedef pair<int, int> pii;
#define mp make_pair

bool comp(pii a, pii b) {
    if (a.first < b.first) return false;
    if (a.first > b.first) return true;
    std::random_device rd;
    return (rd() % 2) ? true : false;
}
void CombSort(vector<pii> &array, int size){
    int h = size;
    bool is_swapped = false;
    int i;
    pii temp;

    while(h > 1 || is_swapped){
        if(h > 1){
            h = (h*10)/13;
        }

        is_swapped = false;
        for(i = 0; i < size-h; ++i){
            if(comp(array[i],array[i+h]) ){
                //swap
                temp = array[i];
                array[i] = array[i+h];
                array[i+h] = temp;
                is_swapped = true;
            }
        }
    }
}

int main() {
    int N;
    cin >> N;
    vector<pii> v;
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        v.push_back(mp(temp, i + 1));
    }

    CombSort(v, v.size());

    int cont = 0;
    int prev = 0;
    int f = 0;
    int count = 0;
    for(int i = 0; i < N; i++) {
        if (v[i].first == prev) {
            cont++;
        } else {
            cont = 0;
        }
        prev = v[i].first;
        if (cont == 2) {f = 1;}
        if (cont == 1) {count++;}
        if (count >= 2) {f = 1;}
    }

    if (f) {
        int c = 0;
        cout << "YES" << endl;
        int arr[3][2000] = {0};
        while(c < 3) {
            CombSort(v, v.size());

            int ok = 1;
            for(int i = 0; i < c; i++) {
                int flag = 0;
                for(int j = 0; j < N; j++) {
                    if (arr[i][j] != v[j].second) {
                        flag = 1;
                    }
                }
                ok &= flag;
            }
            if (ok) {
                for(int j = 0; j < N; j++) {
                    arr[c][j] = v[j].second;
                    cout << v[j].second << " ";
                }
                cout << endl;
                c++;
            }
        }
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  if (N < 3) {
    printf("NO");
    return 0;
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  int cnt = 0;
  REPN(i, 1, N) {
    cnt += (B[i] > 1);
  }
  int f = 1;
  REP(i, N - 1) {
    if (A[i].F != A[i + 1].F) {
      f = 0;
      break;
    }
  }
  if (!f && cnt < 2) {
    printf("NO");
    return 0;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j] >= 2) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REPP(k, 1, B[j]) {
      R[1][s + k] = R[0][s + k - 1];
    }
    R[1][s] = R[0][j - 1];
  }
  REP(i, N) R[2][i] = R[1][i];
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  REP(j, N) printf("%d ", A[j].S + 1);
  printf("\n");
  REP(k, 2) {
    REP(i, N + 1) {
      if (W[i]) continue;
      if (B[i] > 0) W[i] = 1;
      REP(j, B[i] - 1) {
        swap(A[i - B[i] + j], A[i - B[i] + j + 1]);
      }
    }
    REP(j, N) printf("%d ", A[j].S + 1);
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  int cnt = 0;
  REPN(i, 1, N) {
    cnt += (B[i] > 1);
  }
  if (cnt <= 1) {
    printf("NO");
    return 0;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

int N, R[3][MAX], B[MAX];
vector<pair<int, int>> A;

static bool ok() {
  REP(i, 3) {
    REP(j, 3) {
      if (i == j) continue;
      bool ok = false;
      REP(k, N) {
        if (R[i][k] != R[j][k]) {
          ok = true;
          break;
        }
      }
      if (!ok) {
        return false;
      }
    }
  }
  return true;
}

static void pnt() {
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
}

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  if (N < 3) {
    printf("NO");
    return 0;
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = A[j].S;
    }
  }
  REPN(i, 1, N) {
    if (B[i] > 2) {
      swap(R[1][i - B[i]], R[1][i - B[i] + 1]);
      swap(R[2][i - B[i] + 1], R[2][i - B[i] + 2]);
      if (ok()) {
        pnt();
        return 0;
      }
    }
  }
  REPN(i, 1, N) {
    if (B[i] == 2) {
      swap(R[1][i - 2], R[1][i - 1]);
      REPN(j, i + 1, N) {
        if (B[j] == 2) {
          swap(R[2][j - 2], R[2][j - 1]);
          i = j = 1e9;
          break;
        }
      }
    }
  }
  if (ok()) {
    pnt();
    return 0;
  }
  printf("NO");
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  int cnt = 0;
  REPN(i, 1, N) {
    cnt += (B[i] > 1);
  }
  int f = 1;
  REP(i, N - 1) {
    if (A[i].F != A[i + 1].F) {
      f = 0;
      break;
    }
  }
  if (!f && cnt < 2) {
    printf("NO");
    return 0;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    swap(R[1][0], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  if (N < 3) {
    printf("NO");
    return 0;
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  int cnt = 0;
  REPN(i, 1, N) {
    cnt += (B[i] > 1);
  }
  int f = 1;
  REP(i, N - 1) {
    if (A[i].F != A[i + 1].F) {
      f = 0;
      break;
    }
  }
  if (!f && cnt < 2) {
    printf("NO");
    return 0;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REPN(i, 1, 2) {
    int did = 0;
    REP(j, N + 1) {
      if (B[j] == 0) continue;
      int s = j - B[j];
      if (did || W[j]) {
        REP(k, B[j]) {
          R[i][s + k] = R[i - 1][s + k];
        }
      } else {
        REPP(k, 1, B[j]) {
          R[i][s + k] = R[i - 1][s + k - 1];
        }
        R[i][s] = R[i - 1][j - 1];
        did = 1;
        W[j] = 1;
      }
    }
  }
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  int cnt = 0;
  REPN(i, 1, N) {
    cnt += (B[i] > 1);
  }
  if (cnt < 2) {
    printf("NO");
    return 0;
  }
  printf("YES\n");
  REP(i, N) {
    printf("%d ", A[i].S + 1);
  }
  printf("\n");
  REP(i, N + 1) {
    if (B[i] >= 3) {
      swap(A[i - B[i]], A[i - B[i] + 1]);
      REP(j, N) {
        printf("%d ", A[j].S + 1);
      }
      printf("\n");
      swap(A[i - B[i] + 1], A[i - B[i] + 2]);
      REP(j, N) {
        printf("%d ", A[j].S + 1);
      }
      printf("\n");
      return 0;
    }
  }
  int all = 2;
  REP(i, N + 1) {
    if (B[i] == 2 && all > 0) {
      swap(A[i - 2], A[i - 1]);
      REP(j, N) {
        printf("%d ", A[j].S + 1);
      }
      printf("\n");
      --all;
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REP(i, N) R[1][i] = A[i].S;
  REP(i, N) R[2][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][s + B[j] - k - 1]);
    }
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  REP(j, N) printf("%d ", A[j].S + 1);
  printf("\n");
  REP(k, 2) {
    REP(i, N + 1) {
      if (W[i]) continue;
      if (B[i] > 0) W[i] = 1;
      REP(j, B[i] - 1) {
        swap(A[i - B[i] + j], A[i - B[i] + j + 1]);
      }
      if (B[i] > 0) {
        break;
      }
    }
    REP(j, N) printf("%d ", A[j].S + 1);
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REPP(k, 1, B[j]) {
      R[1][s + k] = R[0][s + k - 1];
    }
    R[1][s] = R[0][j - 1];
  }
  REP(i, N) R[2][i] = R[1][i];
  REP(j, N + 1) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  REP(i, 3) {
    REP(j, 3) {
      if (i == j) continue;
      int g = 0;
      REP(k, N) {
        if (R[i][k] != R[j][k]) {
          g = 1;
          break;
        }
      }
      if (!g) {
        printf("NO");
        return 0;
      }
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REPN(i, 1, 2) {
    int did = 0;
    REP(j, N + 1) {
      if (B[j] == 0) continue;
      int s = j - B[j];
      if (did || W[j]) {
        REP(k, B[j]) {
          R[i][s + k] = R[i - 1][s + k];
        }
      } else {
        REPP(k, 1, B[j]) {
          R[i][s + k] = R[i - 1][s + k - 1];
        }
        R[i][s] = R[i - 1][j - 1];
        did = 1;
        W[j] = 1;
      }
    }
  }
  REP(i, 3) {
    REP(j, 3) {
      if (i == j) continue;
      int g = 0;
      REP(k, N) {
        if (R[i][k] != R[j][k]) {
          g = 1;
          break;
        }
      }
      if (!g) {
        printf("NO");
        return 0;
      }
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1 || B[i] > 3) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  REP(i, N) {
    printf("%d ", A[i].S + 1);
  }
  printf("\n");
  int all = 2;
  REP(i, N + 1) {
    if (B[i] > 0 && all > 0) {
      all--;
      swap(A[i - B[i]], A[i - B[i] + 1]);
      REP(j, N) {
        printf("%d ", A[j].S + 1);
      }
      printf("\n");
    }
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(i, N) R[0][i] = A[i].S;
  REP(i, N) R[1][i] = R[0][i];
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][s + B[j] - k - 1]);
    }
  }
  REP(i, N) R[2][i] = R[1][i];
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX], W[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][s + B[j] - k - 1]);
    }
  }
  PER(j, N) {
    if (B[j]) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  REP(i, 3) {
    REP(j, 3) {
      if (i == j) continue;
      int g = 0;
      REP(k, N) {
        if (R[i][k] != R[j][k]) {
          g = 1;
          break;
        }
      }
      if (!g) {
        printf("NO");
        return 0;
      }
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REPN(i, 1, N) {
    if (B[i] == 1) {
      printf("NO");
      return 0;
    }
  }
  printf("YES\n");
  REP(i, N) printf("%d ", A[i].S + 1);
  printf("\n");
  REP(k, 2) {
    REP(i, N + 1) {
      REP(j, B[i] - 1) {
        swap(A[i - B[i] + j], A[i - B[i] + j + 1]);
      }
    }
    REP(j, N) printf("%d ", A[j].S + 1);
    printf("\n");
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <fstream>

#define REP(I, N) for (int I = 0; I < (N); ++I)
#define PER(I, N) for (int I = (N); I >= 0; --I)
#define PERR(I, A, B) for (int I = (A); I >= (B); --I)
#define REPP(I, A, B) for (int I = (A); I <  (B); ++I)
#define REPN(I, A, B) for (int I = (A); I <= (B); ++I)
#define REPC(I, A, C) for (int I = (A); (C); ++I)
#define REPPP(I, A, B, C) for (int I = (A); I <  (B); I += C)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define RIIII(X, Y, Z, W) scanf("%d%d%d%d", &(X), &(Y), &(Z), &(W))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define DRIIII(X, Y, Z, W) int X, Y, Z, W; scanf("%d%d%d%d", &X, &Y, &Z, &W)
#define RS(X) scanf("%s", (X))
#define LEN(X) int(strlen(X))
#define SZ(X) int((X).size())
#define SUM(X, N) accumulate(X, X + (N), 0)
#define MS0(X) memset((X), 0, sizeof(X))
#define MSI(X) memset((X), 0xFF, sizeof(X))
#define F first
#define S second
#define MP make_pair
#define PB push_back

#ifdef DK
const int MAX = 11;
#else
const int MAX = 2e3 + 11;
#endif

using namespace std;

vector<pair<int, int>> A;
int N, B[MAX], R[3][MAX];

int main() {
#ifdef DK
  freopen("in.txt", "r", stdin);
#endif
  RI(N);
  REP(i, N) {
    DRI(x);
    A.PB(MP(x, i));
  }
  if (N < 3) {
    printf("NO");
    return 0;
  }
  sort(A.begin(), A.end());
  REP(i, N) {
    int j = i;
    while (A[i].F == A[j].F) j++;
    B[j] = j - i;
    i = j - 1;
  }
  REP(i, 3) {
    REP(j, N) {
      R[i][j] = -1;
    }
  }
  REP(k, 3) REP(i, N) R[k][i] = A[i].S;
  REP(j, N + 1) {
    if (B[j] == 0) continue;
    int s = j - B[j];
    REP(k, B[j] / 2) {
      swap(R[1][s + k], R[1][j - k - 1]);
    }
    if (B[j] & 1) swap(R[1][s], R[1][s + B[j] / 2]);
  }
  PER(j, N) {
    if (B[j] >= 2) {
      swap(R[2][j - 2], R[2][j - 1]);
      break;
    }
  }
  REP(i, 3) {
    REP(j, 3) {
      if (i == j) continue;
      int g = 0;
      REP(k, N) {
        if (R[i][k] != R[j][k]) {
          g = 1;
          break;
        }
      }
      if (!g) {
        printf("NO");
        return 0;
      }
    }
  }
  printf("YES\n");
  REP(i, 3) {
    REP(j, N) {
      printf("%d ", R[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<pair<int,int> >tasks(n);
    for(int i=0; i<n; i++) {
        cin >> tasks[i].first;
        tasks[i].second=i+1;
    }
        if(n%2) {
        cout << "NO\n";
        return 0;
    }
    else {
        cout << "YES\n";
    }
    sort(tasks.begin(),tasks.end());
    int index=0;
    for(int k=1; k<=3; k++) {
        for(int i=0; i<n; i++) {
                if(i) cout << " ";
            cout << tasks[i].second;
            }
            if(k<3) {
            swap(tasks[index],tasks[index+1]);
            index+=2;
            }
         cout << "\n";
    }
   return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<pair<int,int> >tasks(n);
    for(int i=0; i<n; i++) {
        cin >> tasks[i].first;
        tasks[i].second=i+1;
    }
        if(n%2) {
        cout << "NO\n";
        return 0;
    }
    else {
        cout << "YES\n";
    }
    sort(tasks.rbegin(),tasks.rend());
    int index=0;
    for(int k=1; k<=3; k++) {
        for(int i=0; i<n; i++) {
                if(i) cout << " ";
            cout << tasks[i].second;
            }
            if(k<3) {
            swap(tasks[index],tasks[index+1]);
            index+=2;
            }
         cout << "\n";
    }
   return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<pair<int,int> >tasks(n);
    for(int i=0; i<n; i++) {
        cin >> tasks[i].first;
        tasks[i].second=i+1;
    }
    vector<pair<int,int> >m,u,h;
    sort(tasks.begin(),tasks.end());
    m=tasks;
    int c=0;
    vector<int>ind;
    for(int i=0; i<n-1; i++) {
        if(tasks[i].first==tasks[i+1].first) {
            c++;
            ind.push_back(i);
        }
    }
    if(c>=2) {
        cout << "YES\n";
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << m[i].second;
        }
        swap(tasks[ind[0]],tasks[ind[0]+1]);
        u=tasks;
        cout << "\n";
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << u[i].second;
        }
        cout << "\n";
        swap(tasks[ind[1]],tasks[ind[1]+1]);
        h=tasks;
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << h[i].second;
        }
        cout << "\n";
    }
    else {
        cout << "NO\n";
    }
   return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
int main() {
    int n;
    cin >> n;
    vector<pair<int,int> >tasks(n);
    for(int i=0; i<n; i++) {
        cin >> tasks[i].first;
        tasks[i].second=i+1;
    }
    vector<pair<int,int> >m,u,h;
    sort(tasks.begin(),tasks.end());
    m=tasks;
    int c=0;
    vector<int>ind;
    for(int i=0; i<n-1; i++) {
        if(tasks[i].first==tasks[i+1].first) {
            c++;
            ind.push_back(i);
        }
    }
    if(c==2) {
        cout << "YES\n";
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << m[i].second;
        }
        swap(tasks[ind[0]],tasks[ind[0]+1]);
        u=tasks;
        cout << "\n";
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << u[i].second;
        }
        cout << "\n";
        swap(tasks[ind[1]],tasks[ind[1]+1]);
        h=tasks;
        for(int i=0; i<n; i++) {
            if(i) cout << " ";
            cout << h[i].second;
        }
        cout << "\n";
    }
    else {
        cout << "NO\n";
    }
   return 0;
}


#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int, vector<int> >m;
    vector<int>a, b;
    int x;
    int j = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        m[x].push_back(i + 1);
        if (m[x].size() >= 2)
        {
            j++;
            sort(m[x].begin(), m[x].end());
        }
    }
    int z = 0;
    if (j >= 2)
    {
        cout << "YES" << endl;
        map<int, vector<int> >::iterator it;
        for (it = m.begin(); it != m.end(); it++)
        {
            for (int i = 0; i < it->second.size(); i++)
            {
                a.push_back(it->second[i]);
                b.push_back(it->second[i]);
                cout << it->second[i] << ' ';
                if (i == 1 && it->second.size() == 2 && z == 0)
                {
                    sort(a.rbegin(), a.rend() - a.size() + 2);
                    z++;
                }
                else if (i == 1 && it->second.size() == 2 && z == 1)
                {
                    sort(b.rbegin(), b.rend() - b.size() + 2);
                    z++;
                }
                else if (i == 2 && it->second.size() >= 3)
                {
                    sort(a.rbegin(), a.rend() - a.size() + 3);
                    sort(b.rbegin(), b.rend() - b.size() + 2);
                }
            }
        }
        cout << endl;
        for (int i = 0; i < n; i++)
            cout << a[i] << ' ';
        cout << endl;
        for (int i = 0; i < n; i++)
            cout << b[i] << ' ';
    }
    else
        cout << "NO";
    return 0;
}


#include <map>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int, vector<int> >m;
    vector<int>a, b;
    int x;
    int j = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> x;
        m[x].push_back(i + 1);
        if (m[x].size() >= 2)
        {
            j++;
            sort(m[x].begin(), m[x].end());
        }
    }
    int z = 0;
    if (j >= 2)
    {
        cout << "YES" << endl;
        map<int, vector<int> >::iterator it;
        for (it = m.begin(); it != m.end(); it++)
        {
            for (int i = 0; i < it->second.size(); i++)
            {
                a.push_back(it->second[i]);
                b.push_back(it->second[i]);
                cout << it->second[i] << ' ';
                if (i == 1 && it->second.size() == 2 && z == 0)
                {
                    sort(a.rbegin(), a.rend() - a.size() + 2);
                    z++;
                }
                else if (i == 1 && it->second.size() == 2 && z == 1)
                {
                    sort(b.rbegin(), b.rend() - b.size() + 2);
                    z++;
                }
                else if (i == 2 && it->second.size() == 3)
                {
                    sort(a.rbegin(), a.rend() - a.size() + 3);
                    sort(b.rbegin(), b.rend() - b.size() + 2);
                }
            }
        }
        cout << endl;
        for (int i = 0; i < n; i++)
            cout << a[i] << ' ';
        cout << endl;
        for (int i = 0; i < n; i++)
            cout << b[i] << ' ';
    }
    else
        cout << "NO";
    return 0;
}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<=b.y;}

int n,i,j,a,i1;
Job job[2001];
int m[2001],u[2001],h[2001];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {j=job[i1].y;job[i1].y=job[i1+1].y;job[i1+1].y=j;;i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {j=job[i1].y;job[i1].y=job[i1+1].y;job[i1+1].y=j;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<=b.y;}

int n,i,j,a,i1;
Job job[2001];
int m[2001],u[2001],h[2001];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {j=job[i1].x;job[i1].x=job[i1+1].x;job[i1+1].x=j;;i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {j=job[i1].x;job[i1].x=job[i1+1].x;job[i1+1].x=j;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<=b.y;}

int n,i,j,a,i1;
Job job[2001];
int m[2001],u[2001],h[2001];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<b.y;}

int n,i,j,a,i1;
Job job[2001];
int m[2001],u[2001],h[2001];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<=b.y;}

int n,i,j,a,i1;
Job job[2020];
int m[2020],u[2020],h[2020];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

system("pause");
}


#include <iostream>
#include <algorithm>

using namespace std;
struct Job{int x;int y;};
bool operator <(Job a, Job b)
{return a.y<b.y;}

int n,i,j,a,i1;
Job job[2001];
int m[2001],u[2001],h[2001];

main(){
cin>>n;
for(i=1;i<=n;i++)
{cin>>a;
job[i].x=i;
job[i].y=a;
}

sort(job+1,job+n+1);

for(i=1;i<=n;i++)
{m[i]=job[i].x;}

i1=1;

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);i1++;break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{u[i]=job[i].x;}

while(i1<n)
{if(job[i1].y==job[i1+1].y)
 {swap(job[i1],job[i1+1]);break;}
  else{i1++;}
}
if(i1==n){cout<<"NO"<<endl;return 0;}

for(i=1;i<=n;i++)
{h[i]=job[i].x;}

cout<<"YES"<<endl;
for(i=1;i<n;i++)cout<<m[i]<<" ";
cout<<m[n]<<endl;
for(i=1;i<n;i++)cout<<u[i]<<" ";
cout<<u[n]<<endl;
for(i=1;i<n;i++)cout<<h[i]<<" ";
cout<<h[n]<<endl;

system("pause");
}


#include <iostream>
#include <set>

using namespace std;
struct state {
   int number;
   int indice ;
} t[2000];
int main()
{
int n ;
cin >>n ;
set <int> test ;

for(int i = 0 ; i < n ; i++){
cin >> t[i].number;
t[i].indice=i+1;
test.insert(t[i].number);
}
if(test.size()>=n-1){
cout<<"NO";
return (0);
}
cout<<"YES"<<endl;
state temp;
for(int i=1;i<n;i++)
{
    for(int j=0;j<n-i;j++)
    {
        if(t[j].number > t[j+1].number)
        {
            temp=t[j];
            t[j]=t[j+1];
            t[j+1] = temp;
        }
    }
    }
int in =-1 ;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number){
swap(t[i]  , t[i-1]);
in=i;
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}
cout <<"\n";

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number && in != i){
swap(t[i]  , t[i-1]);
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}

cout <<endl;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
}

    return 0;
}


#include <iostream>
#include <set>

using namespace std;
struct state {
   int number;
   int indice ;
} t[2000];
int main()
{
int n ;
cin >>n ;
set <int> test ;

for(int i = 0 ; i < n ; i++){
cin >> t[i].number;
t[i].indice=i+1;
test.insert(t[i].number);
}
if(test.size()>=n-1){
cout<<"NO ";
return (0);
}
state temp;
for(int i=1;i<n;i++)
{
    for(int j=0;j<n-i;j++)
    {
        if(t[j].number > t[j+1].number)
        {
            temp=t[j];
            t[j]=t[j+1];
            t[j+1] = temp;
        }
    }
    }
int in =-1 ;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number){
swap(t[i]  , t[i-1]);
in=i;
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}
cout <<"\n";

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number && in != i){
swap(t[i]  , t[i-1]);
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}

cout <<endl;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
}

    return 0;
}


#include <iostream>
#include <set>

using namespace std;
struct state {
   int number;
   int indice ;
} t[2000];
int main()
{
int n ;
cin >>n ;
set <int> test ;

for(int i = 0 ; i < n ; i++){
cin >> t[i].number;
t[i].indice=i+1;
test.insert(t[i].number);
}
if(test.size()>=n-1){
cout<<"NO ";
return (0);
}
cout<<"YES"<<endl;
state temp;
for(int i=1;i<n;i++)
{
    for(int j=0;j<n-i;j++)
    {
        if(t[j].number > t[j+1].number)
        {
            temp=t[j];
            t[j]=t[j+1];
            t[j+1] = temp;
        }
    }
    }
int in =-1 ;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number){
swap(t[i]  , t[i-1]);
in=i;
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}
cout <<"\n";

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
if(t[i].number==t[i-1].number && in != i){
swap(t[i]  , t[i-1]);
for( int j=i+1;j<n;j++){
cout <<t[j].indice <<" ";
}
i=n;
}
}

cout <<endl;

for(int i=0;i<n;i++){
cout<<t[i].indice <<" " ;
}

    return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<int> res[3];
map<int,vector<int> > pos;
int main()
{
   int n;
   cin>>n;
   for(int i=1;i<=n;++i)
   {
        int x;
        cin>>x;
        pos[x].push_back(i);
   }
   vector<int> vals;
   for(auto x:pos)
   {
        if(x.second.size()>=2)
            vals.push_back(x.first);
   }
   bool req = true;
   if(vals.size()<2)
   {

    if(vals.size() == 0)
    {
        cout<<"NO\n";
        return 0;
    }
    if(vals.size() == 1 && pos[vals[0]].size() <= 2)
    {
        cout<<"NO\n";
        return 0;
    }
    else
    {
        bool req = false;
         for(auto x:pos)
         {
            if(x.first == vals[0])
            {
            res[0].push_back(x.second[0]);
            res[0].push_back(x.second[1]);
            res[0].push_back(x.second[2]);

            res[1].push_back(x.second[1]);
            res[1].push_back(x.second[0]);
            res[1].push_back(x.second[2]);
            res[2].push_back(x.second[2]);
            res[2].push_back(x.second[1]);
            res[2].push_back(x.second[0]);
            for(int i=3;i<x.second.size();++i)
            {
                res[0].push_back(x.second[i]);
                res[1].push_back(x.second[i]);
                res[2].push_back(x.second[i]);
            }
            }
            else
            {
                for(auto y:x.second)
                {
                    res[0].push_back(y);
                    res[1].push_back(y);
                    res[2].push_back(y);
                }

            }

         }
    }

   }

if(req)
{
   for(auto x:pos)
   {
        if(x.first == vals[0])
        {
            res[0].push_back(x.second[0]);
            res[0].push_back(x.second[1]);
            res[1].push_back(x.second[1]);
            res[1].push_back(x.second[0]);
            res[2].push_back(x.second[0]);
            res[2].push_back(x.second[1]);
            for(int i=2;i<x.second.size();++i)
            {
                res[0].push_back(x.second[i]);
                res[1].push_back(x.second[i]);
                res[2].push_back(x.second[i]);
            }

        }
        else if(x.first == vals[1])
        {
            res[0].push_back(x.second[0]);
            res[0].push_back(x.second[1]);
            res[1].push_back(x.second[1]);
            res[1].push_back(x.second[0]);
            res[2].push_back(x.second[1]);
            res[2].push_back(x.second[0]);
                for(int i=2;i<x.second.size();++i)
            {
                res[0].push_back(x.second[i]);
                res[1].push_back(x.second[i]);
                res[2].push_back(x.second[i]);
            }
        }
        else
        {
            for(auto y:x.second)
            {
                res[0].push_back(y);
                res[1].push_back(y);
                res[2].push_back(y);
            }
        }

   }
}
   cout<<"YES\n";
   for(int i=0;i<3;++i)
   {
    for(int j=0;j<res[i].size();++j)
        cout<<res[i][j]<<" ";
    cout<<"\n";
   }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<int> res[3];
map<int,vector<int> > pos;
int main()
{
   int n;
   cin>>n;
   for(int i=1;i<=n;++i)
   {
        int x;
        cin>>x;
        pos[x].push_back(i);
   }
   vector<int> vals;
   for(auto x:pos)
   {
        if(x.second.size()>=2)
            vals.push_back(x.first);
   }
   if(vals.size()<2)
   {
    cout<<"NO\n";
    return 0;

   }

   for(auto x:pos)
   {
        if(x.first == vals[0])
        {
            res[0].push_back(x.second[0]);
            res[0].push_back(x.second[1]);
            res[1].push_back(x.second[1]);
            res[1].push_back(x.second[0]);
            res[2].push_back(x.second[0]);
            res[2].push_back(x.second[1]);
            for(int i=2;i<x.second.size();++i)
            {
                res[0].push_back(x.second[i]);
                res[1].push_back(x.second[i]);
                res[2].push_back(x.second[i]);
            }

        }
        else if(x.first == vals[1])
        {
            res[0].push_back(x.second[0]);
            res[0].push_back(x.second[1]);
            res[1].push_back(x.second[1]);
            res[1].push_back(x.second[0]);
            res[2].push_back(x.second[1]);
            res[2].push_back(x.second[0]);
                for(int i=2;i<x.second.size();++i)
            {
                res[0].push_back(x.second[i]);
                res[1].push_back(x.second[i]);
                res[2].push_back(x.second[i]);
            }
        }
        else
        {
            for(auto y:x.second)
            {
                res[0].push_back(y);
                res[1].push_back(y);
                res[2].push_back(y);
            }
        }

   }
   cout<<"YES\n";
   for(int i=0;i<3;++i)
   {
    for(int j=0;j<res[i].size();++j)
        cout<<res[i][j]<<" ";
    cout<<"\n";
   }

}