#include <bits/stdc++.h>

using namespace std;

int n, a[20200], b[20200];
int p[20200];

int main () {
	cin >> n;
	for (int i = 1; i <= n; i ++) {
		cin >> p[i];
		a[i] = i * 20200;
		b[i] = (n - i + 1) * 20200;
	}

	for (int i = 1, cur = 0; i <= n; i ++) {
		int j = p[i];
		a[j] += cur;
		++ cur;
	}

	for (int i = 1; i <= n; i ++)
		cout << a[i] << ' ';
	cout << '\n';
	for (int i = 1; i <= n; i ++)
		cout << b[i] << ' ';
}