#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;

int n, p[N], t[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) t[p[i]] = i;
  for (int i = 1; i <= n; i++) cout << 30000 * i << " ";
  cout << endl;
  for (int i = 1; i <= n; i++) cout << 30000 * (n - i) + t[i] << " ";
  cout << endl;
  return 0;
}