#include<iostream>
#include<vector>

#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)

using namespace std;

int nlist[20010];

int main () {
  int N;
  cin >> N;
  REP (i, 0, N) {
    int t;
    cin >> t;
    nlist[t - 1] = i;
  }
  
  int X = 40000;
  
  REP (i, 0, N) {
    cout << X * (i + 1) + nlist[i] << ' ';
  }

  cout << '\n';
  
  REP (i, 0, N) {
    cout << X * (N - i) << ' ';
  }
  
  cout << '\n';
  
  return 0;
}
