#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
int inf_int=2e9;
ll inf_ll=2e18;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define pb push_back
const double pi=3.1415926535898;
#define dout if(debug) cout
#define fi first
#define se second
#define sp setprecision
#define sz size()



template<typename T,typename T1>
void prin(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}

template<typename T,typename T1>
void prin(set<pair<T,T1> >& a)
{
    for(auto it=a.begin();it!=a.end();it++)
    {
        cout <<it->fi <<" "<<it->se<<"\n";
    }
}
template<typename T>
void prin(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i];
        if(i<a.size()-1)
            cout<<" ";
        else
            cout <<"\n";
    }
}


template<typename T>
void prin(set<T>& a)
{
    for(auto it=a.begin();it!=a.end();it++)
    {
        cout << *it<<" ";
    }
}
template<typename T>
void prin_new_line(vector<T>& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i]<<"\n";
    }
}
template<typename T,typename T1>
void prin_new_line(vector<pair<T,T1> >& a)
{
    for(int i=0;i<a.size();i++)
    {
        cout << a[i].fi<<" "<<a[i].se<<"\n";
    }
}

int sum_vec(vector<int>& a)
{
    int s=0;
    for(int i=0;i<a.size();i++)
    {
        s+=a[i];
    }
    return s;
}
template<typename T>
T max(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=max(ans,a[i]);
    }
    return ans;
}

template<typename T>
T min(vector<T>& a)
{
    T ans=a[0];
    for(int i=1;i<a.size();i++)
    {
        ans=min(ans,a[i]);
    }
    return ans;
}
template<typename T>
T min(T a,T b,T c)
{
    return min(a,min(b,c));
}
template<typename T>
T max(T a,T b,T c)
{
    return max(a,max(b,c));
}

long double s_triangle(long double x1,long double y1,long double x2,long double y2,long double x3,long double y3)
{
    return abs(((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2);
}
bool overflow(ll a,ll b)
{
    if(a*b/b!=a)
        return true;
    return false;
}


#define rank asdsad
#define log adzxcsda
#define next xcsadaf
#define x1 asdasdsad
#define y1 zxcasfsagalg
#define x2 zxcasfasf
#define y2 lnhdkfhldfhl
bool debug=0;
const int maxn=3e5+200;
ll mod=1e9+7;

int add_a[maxn];
int add_b[maxn];
void solve()
{
    int n;
    cin >> n;
    int r=25000;
    int l=1;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin >> x;
        if(x%2)
        {
            add_a[x]=r;
            add_b[x]=l;
            r++;
            l++;
        }
        else
        {
            add_a[x]=l;
            add_b[x]=r;
            r++;
            l++;
        }

    }
    for(int i=1;i<=n;i++)
    {
        add_a[i]=add_a[i]+add_a[i-1];
    }
    for(int i=1;i<=n;i++)
    {
        if(i>1)
            cout <<" ";
        cout << add_a[i];
    }
    cout <<"\n";
    for(int i=n;i>=1;i--)
    {
        add_b[i]=add_b[i+1]+add_b[i];
    }
    for(int i=1;i<=n;i++)
    {
        if(i>1)
            cout <<" ";
        cout << add_b[i];
    }
    cout <<"\n";
}






#define FILE "hillwalk"
int main()
{

      // freopen("input.txt","r",stdin);
        //freopen("output.txt","w",stdout);

    //    freopen(FILE".in","r",stdin);
    //    freopen(FILE".out","w",stdout);
       if(!debug)
       {
            ios_base::sync_with_stdio(0);
            cin.tie(0);
           cout.tie(0);
       }

        int t=1;
   //     //scanf("%d",&t);
      //  cin >> t;
         while(t--)
            solve();
        return 0;
}


Measured memory_bytes: 896