#include<iostream>
using namespace std;
int main(){
	int n;
	int a[20000], b[20000];
	cin >> n;
	for(int i = 0; i < n; i++){
		a[i] = i * (n + 1) + 1;
		b[n - i - 1] = i * n + 1;
	}
	for(int i = 1; i <= n; i++){
		int p;
		cin >> p;
		a[p - 1] -= p - i;
	}
	for(int i = 0; i < n; i++){
		cout << a[i];
		if(i != n - 1) cout << ' ';
	}
	cout << endl;
	for(int i = 0; i < n; i++){
		cout << b[i];
		if(i != n - 1) cout << ' ';
	}
	cout << endl;
	return 0;
}