#include<cstdio>
using namespace std;
#define R for(i=0;i++<n;)
#define S(s) int s;scanf("%d",&s);
#define P(x) R printf("%d%c",x[i-1],i<n?32:10);
int main(void){S(n)int a[n],b[n],i;R a[i-1]=b[n-i]=i*n;R{S(p)a[--p]+=i,b[p]+=i;}P(a)P(b)}
