#include<cstdio>
#define MAXN (int)20010
#define _rep(i,a,b) for(int i = (a); i <= (b); ++i)
int N;
int a[MAXN],b[MAXN];
int p[MAXN];
int main(){
	scanf("%d",&N);
	_rep(i,1,N)scanf("%d",&p[i]),a[i] = i * N,b[i] = (N - i + 1) * N;
	_rep(i,1,N)b[p[i]] += (i - 1);
	_rep(i,1,N - 1)printf("%d ",a[i]);printf("%d\n",a[N]);
	_rep(i,1,N - 1)printf("%d ",b[i]);printf("%d\n",b[N]);
	return 0;
}