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

signed main(){
	int n;cin>>n;
	vector<int>p(n),a(n),b(n),q(n);
	for(auto&& w:p)cin>>w;
	for(int i=0;i<n;i++)q[p[i]-1]=i;

	int d=30000;

	for(int i=0;i<n;i++){a[i]=d*(i+1);b[i]=d*(n-i)+q[i];}
	for(int i=0;i<n-1;i++)cout<<a[i]<<" ";
	cout<<a[n-1]<<endl; 
	for(int i=0;i<n-1;i++)cout<<b[i]<<" ";
	cout<<b[n-1]<<endl; 

	
	
}