#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n;

	cin >> n;

	vector<int> a(n);
	vector<int> b(n);

	for (int i = 0; i < n; i++) {
		int p;

		cin >> p;
		p--;

		a[p] = (p + 1) * (n + 1) + i;
		b[p] = (n - p + 1) * (n + 1);
	}

	for (int i = 0; i < n; i++) {
		cout << a[i] << (i == n - 1 ? '\n' : ' ');
	}

	for (int i = 0; i < n; i++) {
		cout << b[i] << (i == n - 1 ? '\n' : ' ');
	}

	return 0;
}