#include<bits/stdc++.h>
using namespace std;

long long int A[200005],B[200005],P[200005];

int main()
{
	int N;
	scanf("%d",&N);
	
	int i;
	
	for (i=0;i<N;i++)
	scanf("%d",&P[i]);
	
	for (i=0;i<N;i++)
	{
		A[i]=(long long)(i)*N;
		B[i]=(long long)(N-1-i)*N;
	}
	
	for (i=1;i<N;i++)
	{
		A[P[i]-1]+=i;
	}
	
	for (i=0;i<N;i++)
	printf("%lld ",A[i]+1);
	printf("\n");
	
	for (i=0;i<N;i++)
	printf("%lld ",B[i]+1);
	
}