#include <bits/stdc++.h>

using namespace std;
const int N = 22222;

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

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &p[i]);
	}
	for (int i = 1; i <= n; i++)
	{
		a[i] = i * n;
		b[i] = n * (n - i + 1);
	}
	for (int i = 1; i <= n; i++) a[p[i]] += i;
	for (int i = 1; i <= n; i++) printf("%d%c", a[i], " \n"[i == n]);
	for (int i = 1; i <= n; i++) printf("%d%c", b[i], " \n"[i == n]);
	return 0;
}