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

const int DIM = 20005;

int arr[DIM];

int main(void)
{
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; ++i) {
        int x; cin >> x;
        arr[x] += i;
    }
    
    for (int i = 1; i <= n; ++i)
        cout << i * DIM << " ";
    cout << endl;
    
    for (int i = 1; i <= n; ++i)
        cout << (n - i + 1) * DIM + arr[i] << " ";
    cout << endl;
    
    return 0;
}
