import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n = readln.chomp.to!int;
	int[] ps = readln.chomp.split.map!(to!int).map!(x => x - 1).array;
	
	int[] as, bs;
	as.length = n, bs.length = n;
	
	for(int i = 0; i < n; i ++){
		as[i] = bs[n - 1 - i] = 30000 * (i + 1);
		}
	
	for(int i = 0; i < n; i ++){
		as[ps[i]] += i, bs[ps[i]] += i;
		}
	
	as.map!(to!string).join(" ").writeln;
	bs.map!(to!string).join(" ").writeln;
	}