#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int p[n],a[n],b[n];
  for(int i=0;i<n;i++) cin>>p[i];
  for(int i=0;i<n;i++) a[i]=25000*(i+1),b[i]=25000*(n-i);
  for(int i=0;i<n;i++) b[p[i]-1]+=i+1;
  for(int i=0;i<n;i++){
    if(i) cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
  for(int i=0;i<n;i++){
    if(i) cout<<" ";
    cout<<b[i];
  }
  cout<<endl;
  return 0;
}
