#include <cstdio>
#define N (int)(2e4+10)
#define INF (int)(1e9)
int n;
int a[N];
int val[N];
int b[N];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&val[i]);
	a[n]=INF,b[1]=INF;
	for(int i=2;i<=n;++i)b[i]=b[i-1]-n;
	for(int i=n-1;i;--i)a[i]=a[i+1]-n;
	for(int i=1;i<=n;++i)a[val[i]]-=(n-i);
	for(int i=1;i<=n;++i)printf("%d ",a[i]);
	printf("\n");
	for(int i=1;i<=n;++i)printf("%d ",b[i]);
}