#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
    {
         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 <vector>
#include <utility>
#include <cmath>
#include<string>
#include <algorithm>
#include<unordered_map>
#include <random>
#include <set>
#include <cstring>
#include <cassert>
#include <map>
#include<stack>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template<typename T>T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<typename T>T lcm(T a, T b){ return b / gcd(a, b) * a; }
template<typename T> T next(){ cout << "A"; T _; cin >> _; return _; }
template<> int next<int>(){ int _; scanf("%d", &_); return _; }
template<> double next<double>(){ double _; scanf("%lf", &_); return _; }
template<> ll next<ll>(){ ll _; scanf("%I64d", &_); return _; }

const int N = 1 << 11;
vector<int> vs[N];

void printIt()
{
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < vs[i].size(); j++)
        {
            cout << vs[i][j]+1 << " ";
        }
    }
    cout << endl;
}

int main()
{
    int n = next<int>();
    for (int i = 0; i < n; i++)
        vs[next<int>()].push_back(i);

    int c = 0, id = -1, jd = -1;
    for (int i = 0; i < N; i++)
    {
        if (vs[i].size() > 1)
        {
            c++;
            jd = id;
            id = i;
        }
    }
    if (c == 0)
        puts("NO");
    else if (c == 1)
    {
        if (vs[id].size() > 2)
        {
            puts("YES");
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
        }
        else
        {
            puts("NO");
        }
    }
    else
    {
        puts("YES");
        printIt();
        next_permutation(vs[jd].begin(), vs[jd].end());
        printIt();
        next_permutation(vs[id].begin(), vs[id].end());
        printIt();
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include<string>
#include <algorithm>
#include<unordered_map>
#include <random>
#include <set>
#include <cstring>
#include <cassert>
#include <map>
#include<stack>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template<typename T>T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<typename T>T lcm(T a, T b){ return b / gcd(a, b) * a; }
template<typename T> T next(){ cout << "A"; T _; cin >> _; return _; }
template<> int next<int>(){ int _; scanf("%d", &_); return _; }
template<> double next<double>(){ double _; scanf("%lf", &_); return _; }
template<> ll next<ll>(){ ll _; scanf("%I64d", &_); return _; }

const int N = 1 << 11;
vector<int> vs[N];

void printIt()
{
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < vs[i].size(); j++)
        {
            cout << vs[i][j]+1 << " ";
        }
    }
    cout << endl;
}

int main()
{
    int n = next<int>();
    for (int i = 0; i < n; i++)
        vs[next<int>()].push_back(i);

    int c = 0, id = -1, jd = -1;
    for (int i = 0; i < N; i++)
    {
        if (vs[i].size() > 1)
        {
            c++;
            jd = id;
            id = i;
        }
    }
    if (c == 0)
        puts("NO");
    else if (c == 1)
    {
        if (vs[id].size() > 2)
        {
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
        }
        else
        {
            puts("NO");
        }
    }
    else
    {
        puts("YES");
        printIt();
        next_permutation(vs[jd].begin(), vs[jd].end());
        printIt();
        next_permutation(vs[id].begin(), vs[id].end());
        printIt();
    }

    return 0;
}


#include <iostream>
#include <vector>
#include <utility>
#include <cmath>
#include<string>
#include <algorithm>
#include<unordered_map>
#include <random>
#include <set>
#include <cstring>
#include <cassert>
#include <map>
#include<stack>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
template<typename T>T gcd(T a, T b){ return b ? gcd(b, a%b) : a; }
template<typename T>T lcm(T a, T b){ return b / gcd(a, b) * a; }
template<typename T> T next(){ cout << "A"; T _; cin >> _; return _; }
template<> int next<int>(){ int _; scanf("%d", &_); return _; }
template<> double next<double>(){ double _; scanf("%lf", &_); return _; }
template<> ll next<ll>(){ ll _; scanf("%I64d", &_); return _; }

const int N = 1 << 11;
vector<int> vs[N];

void printIt()
{
    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j < vs[i].size(); j++)
        {
            cout << vs[i][j]+1 << " ";
        }
    }
    cout << endl;
}

int main()
{
    int n = next<int>();
    for (int i = 0; i < n; i++)
        vs[next<int>()].push_back(i);

    int c = 0, id = -1, jd = -1;
    for (int i = 0; i < N; i++)
    {
        if (vs[i].size() > 1)
        {
            c++;
            jd = id;
            id = i;
        }
    }

    if (c < 2)
    {
        if (vs[id].size() > 2)
        {
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
            next_permutation(vs[id].begin(), vs[id].end());
            printIt();
        }
        else
        {
            puts("NO");
        }
    }
    else
    {
        puts("YES");
        printIt();
        next_permutation(vs[jd].begin(), vs[jd].end());
        printIt();
        next_permutation(vs[id].begin(), vs[id].end());
        printIt();
    }

    return 0;
}


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

using namespace std;

int main(){
    int aux,n;
    cin >> n;
    vector< vector<int> > vec(2001);
    for(int i=1; i<=n; i++){
        cin >> aux;
        vec[aux].push_back(i);
    }
    // Ver si se puede
    int bueno=false;
    int mult=1;
    for(int i=1; i<vec.size(); i++){
       if(vec[i].size())
            mult*=vec[i].size();
       if(mult>=3){
            bueno=true;
            break;
       }
    }

    if(bueno){
        cout << "YES" << endl;
        vector<int> vecRes;
        // Primer orden
        for(int i=0; i<vec.size(); i++){
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
        // Segundo orden
        vecRes.clear();
        for(int i=0; i<vec.size(); i++){
            if(vec[i].size()>1)
                next_permutation(vec[i].begin(),vec[i].end());
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
        // Tercer orden
        vecRes.clear();
        bool primero=true;
        for(int i=0; i<vec.size(); i++){
            if(vec[i].size()>1 && primero){
                next_permutation(vec[i].begin(),vec[i].end());
                primero=0;
            }
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

using namespace std;

int main(){
    int aux,n;
    cin >> n;
    vector< vector<int> > vec(n+1);
    for(int i=1; i<=n; i++){
        cin >> aux;
        vec[aux].push_back(i);
    }
    // Ver si se puede
    int bueno=false;
    int mult=1;
    for(int i=1; i<vec.size(); i++){
       if(vec[i].size())
            mult*=vec[i].size();
       if(mult>=3){
            bueno=true;
            break;
       }
    }

    if(bueno){
        cout << "YES" << endl;
        vector<int> vecRes;
        // Primer orden
        for(int i=0; i<vec.size(); i++){
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
        // Segundo orden
        vecRes.clear();
        for(int i=0; i<vec.size(); i++){
            if(vec[i].size()>1)
                next_permutation(vec[i].begin(),vec[i].end());
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
        // Tercer orden
        vecRes.clear();
        bool primero=true;
        for(int i=0; i<vec.size(); i++){
            if(vec[i].size()>1 && primero){
                next_permutation(vec[i].begin(),vec[i].end());
                primero=0;
            }
            for(int j=0; j<vec[i].size(); j++)
                vecRes.push_back(vec[i][j]);
        }
        cout << vecRes[0];
        for(int i=1; i<vecRes.size(); i++){
            cout << " " << vecRes[i];
        }
        cout << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}


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

using namespace std;

int n;
vector< pair<int,int> > vecOrig;
struct obj{
    int val;
    vector<int> vecNum;
    vector<bool> vecBool;
    obj(int v){
        val=v;
    }
};
vector<obj> vec;

int main(){
    int aux;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> aux;
        vecOrig.push_back( make_pair(aux,i) );
    }
    sort(vecOrig.begin(),vecOrig.end());
    vec.push_back(obj(vecOrig[0].first));
    vec[0].vecNum.push_back(vecOrig[0].second);
    vec[0].vecBool.push_back(0);
    for(int i=1; i<vecOrig.size(); i++){
        if(vecOrig[i].first==vec[vec.size()-1].val){
            vec[vec.size()-1].vecNum.push_back(vecOrig[i].second);
            vec[vec.size()-1].vecBool.push_back(0);
        } else {
            vec.push_back(obj(vecOrig[i].first));
            vec[vec.size()-1].vecNum.push_back(vecOrig[i].second);
            vec[vec.size()-1].vecBool.push_back(0);
        }
    }
    int bueno=false;
    int mult=vec[0].vecNum.size();
    for(int i=1; i<vec.size(); i++){
       mult*=vec[i].vecNum.size();
       if(mult>=3){
            bueno=true;
            break;
       }
    }
    if(bueno){
        cout << "YES" << endl;
        // Encontrar si tiene un >=3
        int pos=-1;
        for(int i=0; i<vec.size(); i++){
            if(vec[i].vecNum.size()>=3){
                pos=i; break;
            }
        }
        if(pos>-1){
            for(int i=0; i<3; i++){
                // Antes de pos
                for(int j=0; j<pos; j++){
                    for(int k=0; k<vec[j].vecNum.size(); k++)
                        cout << vec[j].vecNum[k] << " ";
                }
                // Pos
                next_permutation(vec[pos].vecNum.begin(),vec[pos].vecNum.end());
                for(int k=0; k<vec[pos].vecNum.size(); k++)
                    cout << vec[pos].vecNum[k] << " ";
                // Despues de pos
                for(int j=pos+1; j<vec.size(); j++){
                    for(int k=0; k<vec[j].vecNum.size(); k++)
                        cout << vec[j].vecNum[k] << " ";
                }
                cout << "\b" << endl;
            }
        } else {
            int pos1=-1, pos2=-1;
            for(int i=0; i<vec.size(); i++){
                if(vec[i].vecNum.size()==2){
                    pos1=i; break;
                }
            }
            for(int i=pos1+1; i<vec.size(); i++){
                if(vec[i].vecNum.size()==2){
                    pos2=i; break;
                }
            }
            /*PRIMERA IMPRESION*/
            // Antes de pos
            for(int j=0; j<pos1; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos1
            //next_permutation(vec[pos1].vecNum.begin(),vec[pos1].vecNum.end());
            for(int k=0; k<vec[pos1].vecNum.size(); k++)
                cout << vec[pos1].vecNum[k] << " ";
            // Despues de pos1
            for(int j=pos1+1; j<pos2; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos2
            //next_permutation(vec[pos2].vecNum.begin(),vec[pos2].vecNum.end());
            for(int k=0; k<vec[pos2].vecNum.size(); k++)
                cout << vec[pos2].vecNum[k] << " ";
                // Despues de pos2
            for(int j=pos2+1; j<vec.size(); j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            cout << "\b" << endl;
            /*SEGUNDA IMPRESION*/
            // Antes de pos
            for(int j=0; j<pos1; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos1
            next_permutation(vec[pos1].vecNum.begin(),vec[pos1].vecNum.end());
            for(int k=0; k<vec[pos1].vecNum.size(); k++)
                cout << vec[pos1].vecNum[k] << " ";
            // Despues de pos1
            for(int j=pos1+1; j<pos2; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos2
            //next_permutation(vec[pos2].vecNum.begin(),vec[pos2].vecNum.end());
            for(int k=0; k<vec[pos2].vecNum.size(); k++)
                cout << vec[pos2].vecNum[k] << " ";
                // Despues de pos2
            for(int j=pos2+1; j<vec.size(); j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            cout << "\b" << endl;
            /*TERCERA IMPRESION*/
            // Antes de pos
            for(int j=0; j<pos1; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos1
            //next_permutation(vec[pos1].vecNum.begin(),vec[pos1].vecNum.end());
            for(int k=0; k<vec[pos1].vecNum.size(); k++)
                cout << vec[pos1].vecNum[k] << " ";
            // Despues de pos1
            for(int j=pos1+1; j<pos2; j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            // Pos2
            next_permutation(vec[pos2].vecNum.begin(),vec[pos2].vecNum.end());
            for(int k=0; k<vec[pos2].vecNum.size(); k++)
                cout << vec[pos2].vecNum[k] << " ";
                // Despues de pos2
            for(int j=pos2+1; j<vec.size(); j++){
                for(int k=0; k<vec[j].vecNum.size(); k++)
                    cout << vec[j].vecNum[k] << " ";
            }
            cout << "\b" << endl;

        }

    } else {
        cout << "NO" << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
/*bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}*/
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end());
    int h[2002];
    MEM(h,0);
    int num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,n)
    {
        if(h[i]>1)
            num*=h[i];
        if(num>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                cout<<p[i+1].second<<" "<<p[i].second<<" ";
                i++;
            }
            else
                cout<<p[i].second<<" ";
        }
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                kk.pb(p[i-1].second);
                kk.pb(p[i].second);
                i--;
            }
            else
                kk.pb(p[i].Y);
        }
        rep(k,n)
            cout<<kk[n-1-k]<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end(),&comparator1);
    int h[2002];
    MEM(h,0);
    ll num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,n)
    {
        if(h[i]>1)
            num*=h[i];
        if(h[i]>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                cout<<p[i+1].second<<" "<<p[i].second<<" ";
                i++;
            }
            else
                cout<<p[i].second<<" ";
        }
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>=0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                kk.pb(p[i-1].second);
                kk.pb(p[i].second);
                i--;
            }
            else
                kk.pb(p[i].Y);
        }
        rep(i,n)
            cout<<kk[n-1-i]<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end());
    int h[2002];
    MEM(h,0);
    int num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,n)
    {
        if(h[i]>1)
            num*=h[i];
        if(num>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                cout<<p[i+1].second<<" "<<p[i].second<<" ";
                i++;
            }
            else
                cout<<p[i].second<<" ";
        }
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>=0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                kk.pb(p[i-1].second);
                kk.pb(p[i].second);
                i--;
            }
            else
                kk.pb(p[i].Y);
        }
        rep(k,n)
            cout<<kk[n-1-k]<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end());
    int h[2002];
    MEM(h,0);
    ll num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,2002)
    {
        if(h[i]>1)
            num*=h[i];
        if(num>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n-1;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                int temp;
                temp=p[i+1].second;
                p[i+1].second=p[i].second;
                p[i].second=temp;
                break;
                //kk.pb(p[i-1].second);
                //kk.pb(p[i].second);
                //i--;
            }
        }
        rep(k,n)
            cout<<p[k].second<<" ";
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                int temp;
                temp=p[i-1].second;
                p[i-1].second=p[i].second;
                p[i].second=temp;
                break;
                //kk.pb(p[i-1].second);
                //kk.pb(p[i].second);
                //i--;
            }

        }
        rep(k,n)
            cout<<p[k].second<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end());
    int h[2002];
    MEM(h,0);
    int num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,n)
    {
        if(h[i]>1)
            num*=h[i];
        if(num>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                cout<<p[i+1].second<<" "<<p[i].second<<" ";
                i++;
            }
            else
                cout<<p[i].second<<" ";
        }
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                int temp;
                temp=p[i-1].second;
                p[i-1].second=p[i].second;
                p[i].second=temp;
                break;
                //kk.pb(p[i-1].second);
                //kk.pb(p[i].second);
                //i--;
            }

        }
        rep(k,n)
            cout<<p[k].second<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii > vii;
typedef pair<ll,ll> pll;
typedef vector<string> vs;

#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define MEM(a,b) memset(a,(b),sizeof(a))
#define pr(a) cout<<#a<<" = "<<(a)<<endl
#define cin(n) long long (n); scanf("%lld", &(n))
#define cin2(n,m) long long  (n),(m); scanf("%lld%lld",&(n),&(m))
#define sz(a) int((a).size())
#define all(a) a.begin(),a.end()
#define loop(x,a,b) for(int (x) = (a);(x)<(b);(x)++)
#define rep(x,n)   for(int (x)=0;(x)<(n);(x)++)
#define tr(c,it) for(typeof((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define prc(a) tr(a, it) cout<<*(it)<<" "; cout<<endl
#define pra(a,n) for(int i=0; i<(n); i++) printf("%d ",((a)[i])); printf("\n")
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define ain(a,n) int ((a)[(n)]); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define vin(a,n) vector<int> (a); (a).resize((n)); for(int i=0; i<(n); i++) scanf("%d",&((a)[i]))
#define TEST cin(test); while(test--)
#define FILE
bool comparator1(pair<int,int>A,pair<int,int> B)
{
    if(A.first<=B.first)
        return 1;
    else
        return 0;
    return 0;
}
int main()
{
    cin(n);
    ain(a,n);
    vector<pair<int,int> >p;
    rep(i,n)
    {
        p.pb(mp(a[i],i+1));
    }
    sort(p.begin(),p.end());
    int h[2002];
    MEM(h,0);
    int num=1;
    rep(i,n)
        h[a[i]]++;
    rep(i,n)
    {
        if(h[i]>1)
            num*=h[i];
        if(num>=3)
            break;
    }
    if(num>=3)
    {
        cout<<"YES"<<endl;
        rep(i,n)
            cout<<p[i].second<<" ";
        cout<<endl;
        int i,j,f=0;
        for(i=0;i<n-1;i++)
        {
            if(p[i].first==p[i+1].first && f==0)
            {
                f=1;
                int temp;
                temp=p[i+1].second;
                p[i+1].second=p[i].second;
                p[i].second=temp;
                break;
                //kk.pb(p[i-1].second);
                //kk.pb(p[i].second);
                //i--;
            }
        }
        rep(k,n)
            cout<<p[k].second<<" ";
        cout<<endl;
        vector<int>kk;
        f=0;
        for(i=n-1;i>0;i--)
        {
            if(p[i].first==p[i-1].first && f==0)
            {
                f=1;
                int temp;
                temp=p[i-1].second;
                p[i-1].second=p[i].second;
                p[i].second=temp;
                break;
                //kk.pb(p[i-1].second);
                //kk.pb(p[i].second);
                //i--;
            }

        }
        rep(k,n)
            cout<<p[k].second<<" ";
    }
    else
    {
        cout<<"NO";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> table(2000, vector<int>());
vector<int> data;
vector<int> sequence;
int marker = 0;

void print() {
    for (int i = 0; i < sequence.size(); ++i) {
        if (i) cout << " ";
        cout << sequence[i] + 1;
    }
    cout << "\n";
}

void update() {
    for (int i = marker; i < sequence.size() - 1; ++i) {
        if (data[sequence[i]] == data[sequence[i + 1]]) {
            swap(sequence[i], sequence[i + 1]);
            marker = i + 1;
            break;
        }
    }
}
bool cancomeup() {
    int ans = 1;
    for (int i = marker; (i < sequence.size() - 1) && (ans < 3); ++i) {
        if (data[sequence[i]] == data[sequence[i + 1]]) {
            ++ans;
        }
    }
    return ans == 3;
}
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        data.push_back(val);
        table[val - 1].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < table[i].size(); ++k)
            sequence.push_back(table[i][k]);
    }
    bool yes = cancomeup();
    if (yes) {
        cout << "YES\n";
        print();
        update();
        print();
        update();
        print();
    } else cout << "NO\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> table(2000, vector<int>());
vector<int> data;
vector<int> sequence;
int marker = 0;

void print() {
    for (int i = 0; i < sequence.size(); ++i) {
        if (i) cout << " ";
        cout << sequence[i] + 1;
    }
    cout << "\n";
}

void update() {
    for (int i = marker; i < sequence.size() - 1; ++i) {
            if (data[sequence[i]] == data[sequence[i + 1]]) {
                swap(sequence[i], sequence[i + 1]);
                marker = i + 1;
                break;
            }
    }
}

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        data.push_back(val);
        table[val - 1].push_back(i);
    }
    for (int i = 0; i < n; ++i) {
        for (int k = 0; k < table[i].size(); ++k)
            sequence.push_back(table[i][k]);
    }
    print();
    update();
    print();
    update();
    print();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> table(2000, vector<int>());
vector<int> data;
vector<int> sequence;
int marker = 0;

void print() {
    for (int i = 0; i < sequence.size(); ++i) {
        if (i) cout << " ";
        cout << sequence[i] + 1;
    }
    cout << "\n";
}

void update() {
    for (int i = marker; i < sequence.size() - 1; ++i) {
        if (data[sequence[i]] == data[sequence[i + 1]]) {
            swap(sequence[i], sequence[i + 1]);
            marker = i + 1;
            break;
        }
    }
}
bool cancomeup() {
    int ans = 1;
    for (int i = marker; (i < sequence.size() - 1) && (ans < 3); ++i) {
        if (data[sequence[i]] == data[sequence[i + 1]]) {
            ++ans;
        }
    }
    return ans == 3;
}
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int val;
        cin >> val;
        data.push_back(val);
        table[val - 1].push_back(i);
    }
    for (int i = 0; i < 2000; ++i) {
        for (int k = 0; k < table[i].size(); ++k) {
            sequence.push_back(table[i][k]);
        }
    }
    bool yes = cancomeup();
    if (yes) {
        cout << "YES\n";
        print();
        update();
        print();
        update();
        print();
    } else cout << "NO\n";
    return 0;
}


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

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<pair<int,int>> h(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i].first;
		h[i].second=i+1;
	}

	sort(begin(h),end(h));

	vector<vector<pair<int,int>>> plans(3);
	plans[0]=h;
	for(int i=1;i<3;i++)
	{
		int start,end=0;

		bool good=false;
		for(;;)
		{
			start=end;
			if(start==n)
				break;

			for(end=start+1;end<n&&h[start].first==h[end].first;end++);
			if(next_permutation(begin(h)+start,begin(h)+end))
			{
				good=true;
				break;
			}
		}
		if(!good)
		{
			cout<<"NO";
			return 0;
		}
		plans[i]=h;
	}
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<n;j++)
			cout<<plans[i][j].second<<' ';
		cout<<endl;
	}
}


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

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<pair<int,int>> h(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i].first;
		h[i].second=i+1;
	}

	sort(begin(h),end(h));

	vector<vector<pair<int,int>>> plans(3);
	plans[0]=h;
	for(int i=1;i<3;i++)
	{
		int start,end=0;

		bool good=false;
		for(;;)
		{
			start=end;
			if(start==n)
				break;

			for(end=start+1;end<n&&h[start].first==h[end].first;end++);
			if(next_permutation(begin(h)+start,begin(h)+end))
			{
				good=true;
				break;
			}
			else
				prev_permutation(begin(h)+start,begin(h)+end);
		}
		if(!good)
		{
			cout<<"NO";
			return 0;
		}
		plans[i]=h;
	}
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<n;j++)
			cout<<plans[i][j].second<<' ';
		cout<<endl;
	}
}


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

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<pair<int,int>> h(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i].first;
		h[i].second=i+1;
	}

	sort(begin(h),end(h));

	vector<vector<pair<int,int>>> plans(3);
	plans[0]=h;
	for(int i=1;i<3;i++)
	{
		int start,end=0;

		bool good=false;
		for(;;)
		{
			start=end;
			if(start==n)
				break;

			for(end=start+1;end<n&&h[start].first==h[end].first;end++);
			if(next_permutation(begin(h)+start,begin(h)+end))
			{
				good=true;
				break;
			}
		}
		if(!good)
		{
			cout<<"NO";
			return 0;
		}
		plans[i]=h;
	}

	cout<<"YES"<<endl;
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<n;j++)
			cout<<plans[i][j].second<<' ';
		cout<<endl;
	}
}


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

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<pair<int,int>> h(n);
	for(int i=0;i<n;i++)
	{
		cin>>h[i].first;
		h[i].second=i+1;
	}

	sort(begin(h),end(h));

	vector<vector<pair<int,int>>> plans(3);
	plans[0]=h;
	for(int i=1;i<3;i++)
	{
		int start,end=0;

		bool good=false;
		for(;;)
		{
			start=end;
			if(start==n)
				break;

			for(end=start+1;end<=n&&h[start].first==h[end].first;end++);
			if(next_permutation(begin(h)+start,begin(h)+end))
			{
				good=true;
				break;
			}
			else
				prev_permutation(begin(h)+start,begin(h)+end);
		}
		if(!good)
		{
			cout<<"NO";
			return 0;
		}
		plans[i]=h;
	}
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<n;j++)
			cout<<plans[i][j].second<<' ';
		cout<<endl;
	}
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX 1000005
struct node
{
    int position;
    int strength;
}a[2500];
int b[2500]={0};
int fact(int x)
{
    if(x==0||x==1)
    {
        return 1;

    }
    else
        return (x*fact(x-1));
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i].strength);
        a[i].position=i+1;
        b[a[i].strength]++;
    }
    for(int i=0;i<n-1;i++)
    {
        for(int j=0;j<n-i-1;j++)
        {
            struct node temp;
            if(a[j].strength>a[j+1].strength)
            {
                temp.position=a[j].position;
                temp.strength=a[j].strength;

                a[j].position=a[j+1].position;
                a[j].strength=a[j+1].strength;

                a[j+1].position=temp.position;
                a[j+1].strength=temp.strength;

            }
        }
    }
    int temp=1,flag=0;
    for(int i=0;i<2100;i++)
    {
        temp=temp*fact(b[i]);
        if(temp>=3)
        {
            printf("YES\n");
            flag=1;
            break;
        }

    }
    if(flag==0)
        printf("NO\n");
    else
    {
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");
        int x,y;
        for(int i=0;i<n-1;i++)
        {
            if(a[i].strength==a[i+1].strength)
            {
                x=i;
                y=i+1;
                struct node temp;
                temp.position=a[i].position;
                temp.strength=a[i].strength;

                a[i].position=a[i+1].position;
                a[i].strength=a[i+1].strength;

                a[i+1].position=temp.position;
                a[i+1].strength=temp.strength;
                break;
            }
        }
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");

        for(int i=y;i<n-1;i++)
        {
            if(a[i].strength==a[i+1].strength)
            {
                x=i;
                y=i+1;
                struct node temp;
                temp.position=a[i].position;
                temp.strength=a[i].strength;

                a[i].position=a[i+1].position;
                a[i].strength=a[i+1].strength;

                a[i+1].position=temp.position;
                a[i+1].strength=temp.strength;
                break;
            }
        }
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");

    }

}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX 1000005
struct node
{
    int position;
    int strength;
}a[2500];
int b[2500]={0};
long long fact(int x)
{
    if(x==0||x==1)
    {
        return 1;

    }
    if(x>=3)
        return 3;
    else
        return (x*fact(x-1));
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i].strength);
        a[i].position=i+1;
        b[a[i].strength]++;
    }
    for(int i=0;i<n-1;i++)
    {
        for(int j=0;j<n-i-1;j++)
        {
            struct node temp;
            if(a[j].strength>a[j+1].strength)
            {
                temp.position=a[j].position;
                temp.strength=a[j].strength;

                a[j].position=a[j+1].position;
                a[j].strength=a[j+1].strength;

                a[j+1].position=temp.position;
                a[j+1].strength=temp.strength;

            }
        }
    }
    long long temp=1,flag=0;
    for(int i=0;i<2100;i++)
    {
        temp=temp*fact(b[i]);
        if(temp>=3)
        {
            printf("YES\n");
            flag=1;
            break;
        }

    }
    if(flag==0)
        printf("NO\n");
    else
    {
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");
        int x,y;
        for(int i=0;i<n-1;i++)
        {
            if(a[i].strength==a[i+1].strength)
            {
                x=i;
                y=i+1;
                struct node temp;
                temp.position=a[i].position;
                temp.strength=a[i].strength;

                a[i].position=a[i+1].position;
                a[i].strength=a[i+1].strength;

                a[i+1].position=temp.position;
                a[i+1].strength=temp.strength;
                break;
            }
        }
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");

        for(int i=y;i<n-1;i++)
        {
            if(a[i].strength==a[i+1].strength)
            {
                x=i;
                y=i+1;
                struct node temp;
                temp.position=a[i].position;
                temp.strength=a[i].strength;

                a[i].position=a[i+1].position;
                a[i].strength=a[i+1].strength;

                a[i+1].position=temp.position;
                a[i+1].strength=temp.strength;
                break;
            }
        }
        for(int i=0;i<n;i++)
        {
            printf("%d ",a[i].position);

        }
        printf("\n");

    }

}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

int has[2010];
struct Node
{
    int val;
    int ind;
}a[2010];
int cmp(const Node &a, const Node &b)
{
    return a.val < b.val;
}

int main()
{
    int n;
    scanf("%d",&n);
    memset(has, 0 ,sizeof(has));
    for (int i = 0; i < n; ++i)
    {
        scanf("%d",&a[i].val);
        a[i].ind = i + 1;
        has[a[i].val]++;
    }
    int val3 = -1, val21 = -1, val22 =- 1;
    for (int i = 0; i <= 2000; ++i)
    {
        if (has[i] >= 3)
        {
            val3 = i;break;
        }else if (has[i] == 2)
        {
            if (val21 == -1)
                val21 = i;
            else if (val22 == -1)
                val22 = i;
        }
    }
    if (val3 == -1 && (val21 == -1 || val22 == -1))
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    sort(a, a + n, cmp);
    if (val3 != -1)
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i].ind, a[i + 1].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 1].ind, a[i].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 2].ind, a[i].ind, a[i + 1].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
    }else
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i].ind, a[i + 1].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else if (a[i].val == val22 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

int has[2010];
struct Node
{
    int val;
    int ind;
}a[2010];
int cmp(const Node &a, const Node &b)
{
    return a.val < b.val;
}

int main()
{
    int n;
    scanf("%d",&n);
    memset(has, 0 ,sizeof(has));
    for (int i = 0; i < n; ++i)
    {
        scanf("%d",&a[i].val);
        a[i].ind = i + 1;
        has[a[i].val]++;
    }
    int val3 = -1, val21 = -1, val22 =- 1;
    for (int i = 0; i <= 2000; ++i)
    {
        if (has[i] >= 3)
        {
            val3 = i;break;
        }else if (has[i] == 2)
        {
            if (val21 == -1)
                val21 = i;
            else if (val22 == -1)
                val22 = i;
        }
    }
    if (val3 == -1 && (val21 == -1 || val22 == -1))
    {
        printf("NO\n");
        return 0;
    }
    sort(a, a + n, cmp);
    if (val3 != -1)
    {
        printf("YES\n");
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i].ind, a[i + 1].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 1].ind, a[i].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 2].ind, a[i].ind, a[i + 1].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
    }else
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i].ind, a[i + 1].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else if (a[i].val == val22 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

int has[2010];
struct Node
{
    int val;
    int ind;
}a[2010];
int cmp(const Node &a, const Node &b)
{
    return a.val < b.val;
}

int main()
{
    int n;
    scanf("%d",&n);
    memset(has, 0 ,sizeof(has));
    for (int i = 0; i < n; ++i)
    {
        scanf("%d",&a[i].val);
        a[i].ind = i + 1;
        has[a[i].val]++;
    }
    int val3 = -1, val21 = -1, val22 =- 1;
    for (int i = 0; i <= 2000; ++i)
    {
        if (has[i] >= 3)
        {
            val3 = i;
            break;
        }else if (has[i] == 2)
        {
            if (val21 == -1)
                val21 = i;
            else if (val22 == -1)
                val22 = i;
        }
    }
    if (val3 == -1 && (val21 == -1 || val22 == -1))
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    sort(a, a + n, cmp);
    if (val3 != -1)
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val3 &&(i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d %d", a[i].ind, a[i + 1].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val3 &&(i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d %d", a[i + 1].ind, a[i].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val3 &&(i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d %d", a[i + 2].ind, a[i].ind, a[i + 1].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
    }else
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i].ind, a[i + 1].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else if (a[i].val == val22 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
    }
    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>

using namespace std;

int has[2010];
struct Node
{
    int val;
    int ind;
}a[2010];
int cmp(const Node &a, const Node &b)
{
    return a.val < b.val;
}

int main()
{
    int n;
    scanf("%d",&n);
    memset(has, 0 ,sizeof(has));
    for (int i = 0; i < n; ++i)
    {
        scanf("%d",&a[i].val);
        a[i].ind = i + 1;
        has[a[i].val]++;
    }
    int val3 = -1, val21 = -1, val22 =- 1;
    for (int i = 0; i <= 2000; ++i)
    {
        if (has[i] >= 3)
        {
            val3 = i;break;
        }else if (has[i] == 2)
        {
            if (val21 == -1)
                val21 = i;
            else if (val22 == -1)
                val22 = i;
        }
    }
    if (val3 == -1 && (val21 == -1 || val22 == -1))
    {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    sort(a, a + n, cmp);
    if (val3 != -1)
    {
        printf("YES\n");
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i].ind, a[i + 1].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 1].ind, a[i].ind, a[i + 2].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (i == 0 || a[i].val != a[i - 1].val)
            {
                printf("%d %d %d", a[i + 2].ind, a[i].ind, a[i + 1].ind);
                i += 2;
            }else printf("%d", a[i].ind);
        }
    }else
    {
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i].ind, a[i + 1].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
        cout<<endl;
        for (int i = 0; i < n; ++i)
        {
            if (i != 0)
                printf(" ");
            if (a[i].val == val21 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else if (a[i].val == val22 && (i == 0 || a[i].val != a[i - 1].val))
            {
                printf("%d %d", a[i + 1].ind, a[i].ind);
                i += 1;
            }else printf("%d", a[i].ind);
        }
    }
    return 0;
}


#include <bits/stdtr1c++.h>

using namespace std;

map<int, vector<int>> m;
int fact(int n) {
	int res = 1;
	for (int i = 1; i <= n; i++) {
		res *= i;
	}
	return res;
}

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		m[x].push_back(i);
	}

	int res = 1;
	vector<int> spots;
	for (auto& key : m) {
		if (key.second.size() >= 3) {
			res = 3;
			spots.push_back(key.first);
			break;
		} else {
			res *= fact(key.second.size());
			if (key.second.size() > 1) spots.push_back(key.first);
		}
	}

	if (res < 3) {
		cout << "NO" << endl;
	} else {
		cout << "YES" << endl;
		for (auto& key : m) {
			for (auto val : key.second) {
				cout << val+1 << " ";
			}
		}
		cout << endl;
		int cnt = 1;
		for (int s : spots) {
			while (cnt < 3 && next_permutation(m[s].begin(), m[s].end())) {
				for (auto& key : m) {
					for (auto val : key.second) {
						cout << val+1 << " ";
					}
				}
				cout << endl;
				cnt++;
			};
			if (cnt == 3) break;
		}
	}
	return 0;
}


#include <bits/stdtr1c++.h>

using namespace std;

map<int, vector<int>> m;
int fact(int n) {
	int res = 1;
	for (int i = 1; i <= n; i++) {
		res *= i;
	}
	return res;
}

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		m[x].push_back(i+1);
	}

	int res = 1;
	vector<int> spots;
	for (auto& key : m) {
		if (key.second.size() >= 3) {
			res = 3;
			spots.push_back(key.first);
			break;
		} else {
			res *= fact(key.second.size());
			if (key.second.size() > 1) spots.push_back(key.first);
		}
		if (res > 3) break;
	}

	if (res < 3) {
		cout << "NO" << endl;
	} else {
		cout << "YES" << endl;
		for (auto& key : m) {
			for (auto val : key.second) {
				cout << val << " ";
			}
		}
		cout << endl;
		int cnt = 1;
		for (int s : spots) {
			while (cnt < 3 && next_permutation(m[s].begin(), m[s].end())) {
				for (auto& key : m) {
					for (auto val : key.second) {
						cout << val << " ";
					}
				}
				cout << endl;
				cnt++;
			};
			if (cnt == 3) break;
		}
	}
	return 0;
}


// Editorial code
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

void print(vector<pair<int, int> > &v) {
    for (int i = 0 ; i < v.size() ; i++) cout << v[i].second << ' ';
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > input;

    for (int i = 0 ; i < n ; i++) {
        int x;
        cin >> x;
        input.push_back(make_pair(x, i + 1));
    }

    sort(input.begin(), input.end());

    vector<pair<int, int> > swaps;
    for (int i = 1 ; i < n && swaps.size() < 2 ; i++) {
        if (input[i - 1].first == input[i].first) {
            swaps.push_back(make_pair(i - 1, i));
        }
    }
    if (swaps.size() < 2) {
        cout << "NO";
        return 0;
    }

    cout << "YES" << endl;
    print(input);
    swap(input[swaps[0].first], input[swaps[0].second]);
    print(input);
    swap(input[swaps[1].first], input[swaps[1].second]);
    print(input);
}


//Editorial solution
include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

void print(vector<pair<int, int> > &v) {
    for (int i = 0 ; i < v.size() ; i++) cout << v[i].second << ' ';
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > input;

    for (int i = 0 ; i < n ; i++) {
        int x;
        cin >> x;
        input.push_back(make_pair(x, i + 1));
    }

    sort(input.begin(), input.end());

    vector<pair<int, int> > swaps;
    for (int i = 1 ; i < n && swaps.size() < 2 ; i++) {
        if (input[i - 1].first == input[i].first) {
            swaps.push_back(make_pair(i - 1, i));
        }
    }
    if (swaps.size() < 2) {
        cout << "NO";
        return 0;
    }

    cout << "YES" << endl;
    print(input);
    swap(input[swaps[0].first], input[swaps[0].second]);
    print(input);
    swap(input[swaps[1].first], input[swaps[1].second]);
    print(input);
}


// Editorial code
include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

void print(vector<pair<int, int> > &v) {
    for (int i = 0 ; i < v.size() ; i++) cout << v[i].second << ' ';
    cout << endl;
}

int main() {
    int n;
    cin >> n;
    vector<pair<int, int> > input;

    for (int i = 0 ; i < n ; i++) {
        int x;
        cin >> x;
        input.push_back(make_pair(x, i + 1));
    }

    sort(input.begin(), input.end());

    vector<pair<int, int> > swaps;
    for (int i = 1 ; i < n && swaps.size() < 2 ; i++) {
        if (input[i - 1].first == input[i].first) {
            swaps.push_back(make_pair(i - 1, i));
        }
    }
    if (swaps.size() < 2) {
        cout << "NO";
        return 0;
    }

    cout << "YES" << endl;
    print(input);
    swap(input[swaps[0].first], input[swaps[0].second]);
    print(input);
    swap(input[swaps[1].first], input[swaps[1].second]);
    print(input);
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxx 2050
struct node{
    int x,y,z;
}a[maxx];
bool cmp(node aa,node bb){
   return aa.x<bb.x;
}
int n;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i].x);
        a[i].y=i+1;
        a[i].z=0;
    }
    sort(a,a+n,cmp);
    int t=0;
    int num[maxx];
    memset(num,0,sizeof(num));
    num[0]=1;
    for(int i=1;i<n;i++){
        if(a[i].x!=a[i-1].x){
            ++t;
            num[t]=1;
        }
        else
        {
            num[t]++;
            a[i].z++;
        }
    }
    int sum=1;
    for(int i=0;i<=t;i++)
     sum*=num[i];
     if(sum<3)
        puts("NO");
     else{
        puts("YES");
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
         for(int i=0;i<n;i++){
            if(a[i].x==a[i+1].x)
            {swap(a[i].y,a[i+1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
           for(int i=n;i>=0;i--){
            if(a[i].x==a[i-1].x)
            {swap(a[i].y,a[i-1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
     }

}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxx 2050
struct node{
    int x,y,z;
}a[maxx];
bool cmp(node aa,node bb){
   return aa.x<bb.x;
}
int n;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i].x);
        a[i].y=i+1;
    }
    sort(a,a+n,cmp);
    int t=0;
    int num[maxx];
    memset(num,0,sizeof(num));
    num[0]=1;
    for(int i=1;i<n;i++){
        if(a[i].x!=a[i-1].x){
            ++t;
            num[t]=1;
        }
        else
        {
            num[t]++;
        }
    }
    int sum=1;
    int flag=0;
    for(int i=0;i<=t;i++)
     { sum*=num[i];
     if(sum>3){flag=1;break;}
     }
     if(flag){
        puts("YES");
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
         for(int i=0;i<n;i++){
            if(a[i].x==a[i+1].x)
            {swap(a[i].y,a[i+1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
           for(int i=n;i>=0;i--){
            if(a[i].x==a[i-1].x)
            {swap(a[i].y,a[i-1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
     }
     else
        puts("NO");
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define maxx 2050
struct node{
    int x,y,z;
}a[maxx];
bool cmp(node aa,node bb){
   return aa.x<bb.x;
}
int n;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i].x);
        a[i].y=i+1;
    }
    sort(a,a+n,cmp);
    int t=0;
    int num[maxx];
    memset(num,0,sizeof(num));
    num[0]=1;
    for(int i=1;i<n;i++){
        if(a[i].x!=a[i-1].x){
            ++t;
            num[t]=1;
        }
        else
        {
            num[t]++;
        }
    }
    int sum=1;
    int flag=0;
    for(int i=0;i<=t;i++)
     { sum*=num[i];
     if(sum>=3){flag=1;break;}
     }
     if(flag){
        puts("YES");
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
         for(int i=0;i<n;i++){
            if(a[i].x==a[i+1].x)
            {swap(a[i].y,a[i+1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
           for(int i=n;i>=0;i--){
            if(a[i].x==a[i-1].x)
            {swap(a[i].y,a[i-1].y);break;}
         }
         for(int i=0;i<n;i++)
         {
             printf("%d",a[i].y);
             if(i!=n-1)
                printf(" ");
         }
         puts("");
     }
     else
        puts("NO");
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector < pair<ll, ll> > vll;
typedef pair <int, int> pii;
typedef vector < pii > vii;

#define bitcount(n) __builtin_popcount(n)
#define first first
#define ss second
#define mn INT_MIN
#define mx INT_MAX
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define g(x) cin>>x
#define p(x) cout<<x
#define all(v) v.begin(),v.end()
#define var(a,b)  __typeof(b) a = b
#define mset(a,val) memset(a,val,sizeof(a))
#define rept(i,a,b) for(var(i,a); i < (b); ++i)
#define repd(i,a,b) for(int i = a; i >= (b); --i)
#define rep(i,n)  for(int i = 0;(i) < (n);  ++i)
#define tr(v,it)  for(var(it,v.begin());it!=v.end();++it)
vii ar;
vi a,b,c;
int z[2001];
int main()
{
    int n, ae, u = 0;
    cin>>n;
    rep(i, n) {
        cin>>ae;
        ar.pb(mp(ae, i + 1));
    }
    sort(all(ar));
    rep(i, n)a.pb(ar[i].ss);
    int f = 0;
    rep(i, n - 1) {
        if(ar[i].first == ar[i + 1].first && f == 0) {
            f = 1;
            u = i + 1;
            swap(ar[i], ar[i + 1]);
        }
        b.pb(ar[i].ss);
    }
    b.pb(ar[n - 1].ss);

    int f1 = 0;
    rep(i, u)c.pb(ar[i].ss);
    rept(i, u, n - 1) {
        if(ar[i].first == ar[i + 1].first && f1 == 0) {
            f1 = 1;
            swap(ar[i], ar[i + 1]);
        }
        c.pb(ar[i].ss);
    }
    c.pb(ar[n - 1].ss);

    if(f == 1 && f1 == 1) {
    cout<<"Yes\n";

    rep(i, n)cout<<a[i]<<" ";
    cout<<"\n";
    rep(i, n)cout<<b[i]<<" ";
    cout<<"\n";
    rep(i, n)cout<<c[i]<<" ";
    cout<<"\n";
    }
    else cout<<"No\n";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector < pair<ll, ll> > vll;
typedef pair <int, int> pii;
typedef vector < pii > vii;

#define bitcount(n) __builtin_popcount(n)
#define first first
#define ss second
#define mn INT_MIN
#define mx INT_MAX
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define g(x) cin>>x
#define p(x) cout<<x
#define all(v) v.begin(),v.end()
#define var(a,b)  __typeof(b) a = b
#define mset(a,val) memset(a,val,sizeof(a))
#define rept(i,a,b) for(var(i,a); i < (b); ++i)
#define repd(i,a,b) for(int i = a; i >= (b); --i)
#define rep(i,n)  for(int i = 0;(i) < (n);  ++i)
#define tr(v,it)  for(var(it,v.begin());it!=v.end();++it)
vii ar;
vi a,b,c;
int z[2001];
int main()
{
    int n, ae, u = 0;
    cin>>n;
    rep(i, n) {
        cin>>ae;
        ar.pb(mp(ae, i + 1));
    }
    sort(all(ar));
    rep(i, n)a.pb(ar[i].ss);
    int f = 0;
    rep(i, n - 1) {
        if(ar[i].first == ar[i + 1].first && f == 0) {
            f = 1;
            u = i + 1;
            swap(ar[i], ar[i + 1]);
        }
        b.pb(ar[i].ss);
    }
    b.pb(ar[n - 1].ss);

    int f1 = 0;
    rep(i, u)c.pb(ar[i].ss);
    rept(i, u, n - 1) {
        if(ar[i].first == ar[i + 1].first && f1 == 0) {
            f1 = 1;
            swap(ar[i], ar[i + 1]);
        }
        c.pb(ar[i].ss);
    }
    c.pb(ar[n - 1].ss);

    if(f == 1 && f1 == 1) {
    cout<<"YES\n";

    rep(i, n)cout<<a[i]<<" ";
    cout<<"\n";
    rep(i, n)cout<<b[i]<<" ";
    cout<<"\n";
    rep(i, n)cout<<c[i]<<" ";
    cout<<"\n";
    }
    else cout<<"NO\n";

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector < pair<ll, ll> > vll;
typedef pair <int, int> pii;
typedef vector < pii > vii;

#define bitcount(n) __builtin_popcount(n)
#define first first
#define ss second
#define mn INT_MIN
#define mx INT_MAX
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define g(x) cin>>x
#define p(x) cout<<x
#define all(v) v.begin(),v.end()
#define var(a,b)  __typeof(b) a = b
#define mset(a,val) memset(a,val,sizeof(a))
#define rept(i,a,b) for(var(i,a); i < (b); ++i)
#define repd(i,a,b) for(int i = a; i >= (b); --i)
#define rep(i,n)  for(int i = 0;(i) < (n);  ++i)
#define tr(v,it)  for(var(it,v.begin());it!=v.end();++it)
vii ar;
vi a,b,c;
int z[2001];
int main()
{
    int n;
    cin>>n;
    int s;
    int f = 0;
    int re = 0;
    int aq;
    int p, q, r, u, v;
    int fl,f1,f2;
    fl = f1 = f2 = 0;
    int x, y;
    rept(i, 1, n + 1) {
        int a;
        cin>>a;
        z[a]++;
        aq = a;
        if(z[a] >= 3)f = aq;
        if(z[a] == 2)re++;
        ar.pb(mp(a, i));
    }
    sort(all(ar));
    if(f != 0) {
            //int fl = 0;
        rep(i, n) {
            if(ar[i].first == f && fl == 0) {
                    fl = 1;
                    a.pb(ar[i].ss);
                    b.pb(ar[i + 1].ss);
                    c.pb(ar[i + 2].ss);
                    a.pb(ar[i + 1].ss);
                    b.pb(ar[i + 2].ss);
                    c.pb(ar[i + 1].ss);
                    a.pb(ar[i + 2].ss);
                    b.pb(ar[i].ss);
                    c.pb(ar[i].ss);
                    i += 2;
                    continue;
            }
            a.pb(ar[i].ss);
            b.pb(ar[i].ss);
            c.pb(ar[i].ss);
        }
        cout<<"YES\n";
        rep(i,sz(a))cout<<a[i]<<" ";
        cout<<"\n";
        rep(i,sz(b))cout<<b[i]<<" ";
        cout<<"\n";
        rep(i,sz(c))cout<<c[i]<<" ";
        cout<<"\n";
        return 0;
    }
    else if(re >= 2) {
    f1 = f2 = 0;
        rep(i, 2001) {
            if(z[i] == 2) {
                x = i;
            }
        }
        rep(i, 2001) {
            if(z[i] == 2 && i != x) {
                y = i;
            }
        }
        //cout<<x<<" "<<y;
        f1 = f2 = 0;
        rep(i, n) {
            if(ar[i].first == y && fl == 0) {
                    fl = 1;
                    a.pb(ar[i].ss);
                    b.pb(ar[i + 1].ss);
                    c.pb(ar[i].ss);
                    a.pb(ar[i + 1].ss);
                    b.pb(ar[i].ss);
                    c.pb(ar[i + 1].ss);
                    i += 1;
                    continue;
            }
            else if(ar[i].first == x && f2 == 0) {
                    f2 = 1;
                    a.pb(ar[i].ss);
                    b.pb(ar[i].ss);
                    c.pb(ar[i + 1].ss);
                    a.pb(ar[i + 1].ss);
                    b.pb(ar[i].ss);
                    c.pb(ar[i].ss);
                    i += 1;
                    continue;
            }
            a.pb(ar[i].ss);
            b.pb(ar[i].ss);
            c.pb(ar[i].ss);
        }
        cout<<"YES\n";
        rep(i,sz(a))cout<<a[i]<<" ";
        cout<<"\n";
        rep(i,sz(b))cout<<b[i]<<" ";
        cout<<"\n";
        rep(i,sz(c))cout<<c[i]<<" ";
        cout<<"\n";
        return 0;
    }
    else cout<<"NO\n";
    return 0;
}


import java.util.*;
import java.lang.*;
public class B41
	{
	public static void main(String[] args)
		{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();int i=0,j=0;
		Data[] obj = new Data[n];
		for(i=0;i<n;i++)
			{
			obj[i]=new Data(in.nextInt(),i+1);
			}
		int max=0,low=1,high=1;
		obj=MergeSort(obj,0,n-1);
		for(i=0;i<n-1;i++)
			{
			for(j=n-1;j>i;j--)
				{
				if(obj[i].getIndex()<obj[j].getIndex())
					{
					if(max<obj[j].getValue()-obj[i].getValue())
						{
						max=obj[j].getValue()-obj[i].getValue();
						low=obj[i].getValue();
						high=obj[j].getValue();
						}
					}
				}
			}
		int ans=(k/low)*high+(k%low);
		System.out.println(ans);
		}
	public static Data[] MergeSort(Data[] a,int low,int high)
		{
		if(low>=high)
			{
			return a;
			}
		else
			{
			int middle=(high+low)/2;
			Data[] left = new Data [middle-low+1];
			Data[] right = new Data [high-middle];
			int i=0,count=0;
			for(i=0;i<=middle-low;i++)
				{
				left[count]=a[i];count++;
				}
			count=0;
			for(i=middle+1-low;i<=high-low;i++)
				{
				right[count]=a[i];count++;
				}
			Data[] SortedLeft =MergeSort(left,low,middle);
			Data[] SortedRight =MergeSort(right,middle+1,high);
			return Merge(SortedLeft,SortedRight,low,high);
			}
		}
	public static Data[] Merge(Data[] sl,Data[] sr,int low,int high)
		{
		Data fina[]  = new Data[high-low+1];
		int i=0,middle =(high+low)/2;
		int a=0,b=0,alimit=middle-low+1,blimit=high-middle;
		int n=alimit+blimit;
		/*System.out.println("sl");
		for(i=0;i<alimit;i++)
			{
			int x = sl[i].getValue();
			int y = sl[i].getIndex();
			System.out.println(x+" "+y);
			}
		System.out.println("sr");
		for(i=0;i<blimit;i++)
			{
			int x = sr[i].getValue();
			int y = sr[i].getIndex();
			System.out.println(x+" "+y);
			}*/
		for(i=0;i<n;i++)
			{
			if(a!=alimit&&(b==blimit||(sl[a].getValue()<=sr[b].getValue()&&a<alimit)))
				{
				fina[i]=new Data(sl[a].getValue(),sl[a].getIndex());
				a++;
				}
			else
				{
				fina[i]=new Data(sr[b].getValue(),sr[b].getIndex());
				b++;
				}
			}
		return fina;
		}
	}
 class Data
	{
	private int val;
	private int index;
	public Data(int x,int y)
		{
		val=x;
		index=y;
		}
	public int getValue()
		{
		return this.val;
		}
	public int getIndex()
		{
		return this.index;
		}
	}


import java.util.*;
import java.lang.*;
public class B41
	{
	public static void main(String[] args)
		{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();int i=0,j=0,count=0;
		Data[] obj = new Data[n];
		for(i=0;i<n;i++)
			{
			obj[i]=new Data(in.nextInt(),i+1);
			}
		int max=0,low=1,high=1;
		obj=MergeSort(obj,0,n-1);
		for(i=0;i<n-1;i++)
			{
			for(j=n-1;j>i;j--)
				{
				if(obj[i].getIndex()<obj[j].getIndex())
					{
					if(max<obj[j].getValue()-obj[i].getValue())
						{count=0
						max=obj[j].getValue()-obj[i].getValue();
						low=obj[i].getValue();
						high=obj[j].getValue();count++;
						}
					}
				if(count==1)
					{count=0;continue;
					}
				}
			}
		int ans=(k/low)*high+(k%low);
		System.out.println(ans);
		}
	public static Data[] MergeSort(Data[] a,int low,int high)
		{
		if(low>=high)
			{
			return a;
			}
		else
			{
			int middle=(high+low)/2;
			Data[] left = new Data [middle-low+1];
			Data[] right = new Data [high-middle];
			int i=0,count=0;
			for(i=0;i<=middle-low;i++)
				{
				left[count]=a[i];count++;
				}
			count=0;
			for(i=middle+1-low;i<=high-low;i++)
				{
				right[count]=a[i];count++;
				}
			Data[] SortedLeft =MergeSort(left,low,middle);
			Data[] SortedRight =MergeSort(right,middle+1,high);
			return Merge(SortedLeft,SortedRight,low,high);
			}
		}
	public static Data[] Merge(Data[] sl,Data[] sr,int low,int high)
		{
		Data fina[]  = new Data[high-low+1];
		int i=0,middle =(high+low)/2;
		int a=0,b=0,alimit=middle-low+1,blimit=high-middle;
		int n=alimit+blimit;
		/*System.out.println("sl");
		for(i=0;i<alimit;i++)
			{
			int x = sl[i].getValue();
			int y = sl[i].getIndex();
			System.out.println(x+" "+y);
			}
		System.out.println("sr");
		for(i=0;i<blimit;i++)
			{
			int x = sr[i].getValue();
			int y = sr[i].getIndex();
			System.out.println(x+" "+y);
			}*/
		for(i=0;i<n;i++)
			{
			if(a!=alimit&&(b==blimit||(sl[a].getValue()<=sr[b].getValue()&&a<alimit)))
				{
				fina[i]=new Data(sl[a].getValue(),sl[a].getIndex());
				a++;
				}
			else
				{
				fina[i]=new Data(sr[b].getValue(),sr[b].getIndex());
				b++;
				}
			}
		return fina;
		}
	}
 class Data
	{
	private int val;
	private int index;
	public Data(int x,int y)
		{
		val=x;
		index=y;
		}
	public int getValue()
		{
		return this.val;
		}
	public int getIndex()
		{
		return this.index;
		}
	}


import java.util.*;
import java.lang.*;
public class B41
	{
	public static void main(String[] args)
		{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();int i=0,j=0,count=0;
		Data[] obj = new Data[n];
		for(i=0;i<n;i++)
			{
			obj[i]=new Data(in.nextInt(),i+1);
			}
		int max=0,low=1,high=1;
		obj=MergeSort(obj,0,n-1);
		for(i=0;i<n-1;i++)
			{
			for(j=n-1;j>i;j--)
				{
				if(obj[i].getIndex()<obj[j].getIndex())
					{
					if(max<obj[j].getValue()-obj[i].getValue())
						{count=0;
						max=obj[j].getValue()-obj[i].getValue();
						low=obj[i].getValue();
						high=obj[j].getValue();count++;
						}
					}
				if(count==1)
					{count=0;continue;
					}
				}
			}
		int ans=(k/low)*high+(k%low);
		System.out.println(ans);
		}
	public static Data[] MergeSort(Data[] a,int low,int high)
		{
		if(low>=high)
			{
			return a;
			}
		else
			{
			int middle=(high+low)/2;
			Data[] left = new Data [middle-low+1];
			Data[] right = new Data [high-middle];
			int i=0,count=0;
			for(i=0;i<=middle-low;i++)
				{
				left[count]=a[i];count++;
				}
			count=0;
			for(i=middle+1-low;i<=high-low;i++)
				{
				right[count]=a[i];count++;
				}
			Data[] SortedLeft =MergeSort(left,low,middle);
			Data[] SortedRight =MergeSort(right,middle+1,high);
			return Merge(SortedLeft,SortedRight,low,high);
			}
		}
	public static Data[] Merge(Data[] sl,Data[] sr,int low,int high)
		{
		Data fina[]  = new Data[high-low+1];
		int i=0,middle =(high+low)/2;
		int a=0,b=0,alimit=middle-low+1,blimit=high-middle;
		int n=alimit+blimit;
		/*System.out.println("sl");
		for(i=0;i<alimit;i++)
			{
			int x = sl[i].getValue();
			int y = sl[i].getIndex();
			System.out.println(x+" "+y);
			}
		System.out.println("sr");
		for(i=0;i<blimit;i++)
			{
			int x = sr[i].getValue();
			int y = sr[i].getIndex();
			System.out.println(x+" "+y);
			}*/
		for(i=0;i<n;i++)
			{
			if(a!=alimit&&(b==blimit||(sl[a].getValue()<=sr[b].getValue()&&a<alimit)))
				{
				fina[i]=new Data(sl[a].getValue(),sl[a].getIndex());
				a++;
				}
			else
				{
				fina[i]=new Data(sr[b].getValue(),sr[b].getIndex());
				b++;
				}
			}
		return fina;
		}
	}
 class Data
	{
	private int val;
	private int index;
	public Data(int x,int y)
		{
		val=x;
		index=y;
		}
	public int getValue()
		{
		return this.val;
		}
	public int getIndex()
		{
		return this.index;
		}
	}


import java.util.*;
import java.lang.*;
public class B41
	{
	public static void main(String[] args)
		{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();int i=0,j=0,count=0;
		Data[] obj = new Data[n];
		for(i=0;i<n;i++)
			{
			obj[i]=new Data(in.nextInt(),i+1);
			}
		int max=0,low=1,high=1;
		obj=MergeSort(obj,0,n-1);
		for(i=0;i<n-1;i++)
			{
			for(j=n-1;j>i;j--)
				{
				if(obj[i].getIndex()<obj[j].getIndex())
					{
					if(max<obj[j].getValue()-obj[i].getValue())
						{count=0;
						max=obj[j].getValue()-obj[i].getValue();
						low=obj[i].getValue();
						high=obj[j].getValue();count++;
						}
					}
				if(count==1)
					{count=0;break;
					}
				}
			}
		int ans=(k/low)*high+(k%low);
		System.out.println(ans);
		}
	public static Data[] MergeSort(Data[] a,int low,int high)
		{
		if(low>=high)
			{
			return a;
			}
		else
			{
			int middle=(high+low)/2;
			Data[] left = new Data [middle-low+1];
			Data[] right = new Data [high-middle];
			int i=0,count=0;
			for(i=0;i<=middle-low;i++)
				{
				left[count]=a[i];count++;
				}
			count=0;
			for(i=middle+1-low;i<=high-low;i++)
				{
				right[count]=a[i];count++;
				}
			Data[] SortedLeft =MergeSort(left,low,middle);
			Data[] SortedRight =MergeSort(right,middle+1,high);
			return Merge(SortedLeft,SortedRight,low,high);
			}
		}
	public static Data[] Merge(Data[] sl,Data[] sr,int low,int high)
		{
		Data fina[]  = new Data[high-low+1];
		int i=0,middle =(high+low)/2;
		int a=0,b=0,alimit=middle-low+1,blimit=high-middle;
		int n=alimit+blimit;
		/*System.out.println("sl");
		for(i=0;i<alimit;i++)
			{
			int x = sl[i].getValue();
			int y = sl[i].getIndex();
			System.out.println(x+" "+y);
			}
		System.out.println("sr");
		for(i=0;i<blimit;i++)
			{
			int x = sr[i].getValue();
			int y = sr[i].getIndex();
			System.out.println(x+" "+y);
			}*/
		for(i=0;i<n;i++)
			{
			if(a!=alimit&&(b==blimit||(sl[a].getValue()<=sr[b].getValue()&&a<alimit)))
				{
				fina[i]=new Data(sl[a].getValue(),sl[a].getIndex());
				a++;
				}
			else
				{
				fina[i]=new Data(sr[b].getValue(),sr[b].getIndex());
				b++;
				}
			}
		return fina;
		}
	}
 class Data
	{
	private int val;
	private int index;
	public Data(int x,int y)
		{
		val=x;
		index=y;
		}
	public int getValue()
		{
		return this.val;
		}
	public int getIndex()
		{
		return this.index;
		}
	}


import java.io.*;
import java.util.*;
import java.math.*;

public class Solution {

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer st;

    public String next() throws Exception {
        if (st == null || !st.hasMoreElements()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }

    public void run() throws Exception {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        int n = nextInt();
        int b = nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        int ans = b;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                int d = 0, x = b;
                if (x > a[i]) {
                    d = x / a[i];
                    x %= a[i];
                }
                x = x + d * a[j];
                if (ans < x) ans = x;
            }
        }
        out.println(ans);
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new Solution().run();
    }
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class B {
	private static BufferedReader in;
	private static StringTokenizer st;
	private static PrintWriter out;

	public static void main(String[] args) throws NumberFormatException,
			IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		st = new StringTokenizer("");
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
				System.out)));
		int n = nextInt();
		int b = nextInt();
		int a[] = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			a[i] = nextInt();
		}
		int max = Integer.MIN_VALUE;
		int x = b;
		for (int i = 1; i <= n; i++) {
			int m = a[i]; boolean f=false;
			for (int j = i + 1; j <= n; j++) {
				if (m < a[j]) {
					m = a[j];
					f=true;
				}
			}
			if(f)
				x=b%a[i]+b/a[i]*m;
			max=Math.max(max, x);
		}
		System.out.println(max);
	}

	static String next() throws IOException {
		while (!st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	static int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(next());
	}

	static long nextLong() throws NumberFormatException, IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(next());
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader br;

    static PrintWriter out;

    static StringTokenizer st;

    static void solve() throws Exception {
        int n = nextInt();
        int b = nextInt();
        int[] a = new int[n];
        for(int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        int max = b;
        for(int i = 0; i < n; i++) {
            for(int j = i + 1; j < n; j++) {
                int x = a[i];
                int y = a[j];
                int val = (b / a[i]) * a[j] + (b % a[i]);
                max = Math.max(val, max);
            }
        }
        out.println(max);
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    public static void main(String[] args) {
        try {
            InputStream input = System.in;
            OutputStream output = System.out;
            br = new BufferedReader(new InputStreamReader(input));
            out = new PrintWriter(new PrintStream(output));
            solve();
            out.close();
            br.close();
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author nasko
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskB {
    public void solve(int testNumber, InputReader in, PrintWriter out) {

        int n = in.nextInt();
        int b = in.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; ++i) {
            arr[i] = in.nextInt();
        }

        int max = 0;
        for(int i = 0; i < n; ++i) {
            for(int j = i; j < n; ++j) {

                int buy = b / arr[i];
                int over = b % arr[i];
                int sell = buy * arr[j];
                max = Math.max(max,sell+over);
            }
        }
        out.println(max);

    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

}


import java.util.Random;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStreamReader;
import java.io.File;
import java.math.BigInteger;

public class Task{

	static final boolean readFromFile = false;
	static final String fileInputName = "input.txt",
						fileOutputName = "output.txt";

	public static void main(String args[]){
		FileInputStream fileInputStream;
		FileOutputStream fileOutputStream;
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		if (readFromFile){
			try{
				fileInputStream = new FileInputStream(new File(fileInputName));
				fileOutputStream = new FileOutputStream(new File(fileOutputName));
			}catch (FileNotFoundException e){
				throw new RuntimeException(e);
			}
		}
		PrintWriter out = new PrintWriter((readFromFile)?fileOutputStream:outputStream);
		InputReader in  = new InputReader((readFromFile)?fileInputStream:inputStream);

		Solver s = new Solver(in, out);
		s.solve();

		out.close();
	}
}

class Solver{
	private PrintWriter out;
	private InputReader in;

	public void solve(){
		int n = in.nextInt(),
			b = in.nextInt(),
			a[] = new int[n];
		for (int i=0;i<n;i++)
			a[i] = in.nextInt();
		int ans = b;
		for (int i=0;i<n;i++)
			for (int j=i+1;j<n;j++){
				int ta = b/a[i],
					tb = b%a[i];
				ta = ta*a[j]+tb;
				ans = Math.max(ans, ta);
			}
		out.println(ans);
	}

	Solver(InputReader in, PrintWriter out){
		this.in = in;
		this.out = out;
	}
}

class InputReader{
	StringTokenizer tok;
	BufferedReader buf;

	InputReader(InputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}

	InputReader(FileInputStream in){
		tok = null;
		buf = new BufferedReader(new InputStreamReader(in));
	}

	public String next(){
		while (tok==null || !tok.hasMoreTokens()){
			try{
				tok = new StringTokenizer(buf.readLine());
			}catch (IOException e){
				throw new RuntimeException(e);
			}
		}
		return tok.nextToken();
	}

	public int nextInt(){
		return Integer.parseInt(next());
	}
	public long nextLong(){
		return Long.parseLong(next());
	}
	public double nextDouble(){
		return Double.parseDouble(next());
	}
	public float nextFloat(){
		return Float.parseFloat(next());
	}
	public String nextLine(){
		try{
			return buf.readLine();
		}catch (IOException e){
			return null;
		}
	}
}


import java.io.*;
import java.util.*;

public class B {

	void run() throws IOException {
		int n = ni(), b = ni();
		int[] a = na(n);
		int max = b;
		for (int i = 0; i < n; i++) {
			int d = b / a[i];
			int p = b % a[i];
			for (int j = i + 1; j < n; j++) {
				if (p + d * a[j] > max)
					max = p + d * a[j];
			}

		}
		pw.println(max);
	}

	int[] na(int a_len) throws IOException {
		int[] _a = new int[a_len];
		for (int i = 0; i < a_len; i++)
			_a[i] = ni();
		return _a;
	}

	int[][] nm(int a_len, int a_hei) throws IOException {
		int[][] _a = new int[a_len][a_hei];
		for (int i = 0; i < a_len; i++)
			for (int j = 0; j < a_hei; j++)
				_a[i][j] = ni();
		return _a;
	}

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(next());
	}

	String nl() throws IOException {
		return br.readLine();
	}

	void tr(String debug) {
		if (!OJ)
			pw.println(" " + debug);
	}

	static PrintWriter pw;
	static BufferedReader br;
	static StringTokenizer st;
	static boolean OJ;

	public static void main(String[] args) throws IOException {
		long timeout = System.currentTimeMillis();
		OJ = System.getProperty("ONLINE_JUDGE") != null;
		pw = new PrintWriter(System.out);
		br = new BufferedReader(OJ ? new InputStreamReader(System.in) : new FileReader(new File("B.txt")));

		while (br.ready())
			new B().run();
		if (!OJ) {
			pw.println();
			pw.println(System.currentTimeMillis() - timeout);
		}
		br.close();
		pw.close();
	}

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class B {
    private static BufferedReader in;
    private static StringTokenizer st;
    private static PrintWriter out;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        st = new StringTokenizer("");
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        int n =  nextInt();
        int b = nextInt();
        int a[] = new int [n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        int max = b;
        for (int i = 0; i < n-1; i++) {
            for (int j = i+1; j < n; j++) {
                if(i==j)
                    continue;
                int dollar = b / a[i];
                int mod = b % a[i];
                int foyda = dollar * a[j] + mod;
                max = Math.max(foyda, max);
            }
        }
        System.out.println(max);

    }
    static String next() throws IOException{
        while(!st.hasMoreTokens()){
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    static int nextInt() throws NumberFormatException, IOException{
        return Integer.parseInt(next());
    }

    static long nextLong() throws NumberFormatException, IOException{
        return Long.parseLong(next());
    }

    static double nextDouble() throws NumberFormatException, IOException{
        return Double.parseDouble(next());
    }

}