#include<cstdio>
using namespace std;
int n;
int a[20010],b[20010],p[20010];
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]=i*(n+1);
		b[i]=(n-i+1)*(n+1);
	}
	for (int i=1;i<=n;i++)
			b[p[i]]-=(n-i+1);
	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;
}