#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAXN = 20005;
int p[MAXN],n,a[MAXN],b[MAXN];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		scanf("%d",p+i);
	for(int i=1;i<=n;++i)a[i]=n*i;
	for(int i=i;i<=n;++i)b[i]=n*(n-i+1);
	int now=0;
	for(int i=1;i<=n;++i)
		a[p[i]]+=(now++);
	for(int i=1;i<=n;++i)printf("%d ",a[i]);
	puts("");
	for(int i=1;i<=n;++i)printf("%d ",b[i]);
	return 0;
}
