import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    int[] ps;
    ps.length = N;
    foreach (i, p; readln.split.to!(int[])) {
        ps[p-1] = i.to!int;
    }

    int[] as, bs;
    as.length = N;
    bs.length = N;
    foreach (int i; 0..N) {
        as[i] = i+1;
        bs[N-i-1] = i+1;
    }
    foreach (dd, p; ps) {
        if (!dd) continue;
        auto d = dd.to!int;
        foreach (i; 0..N) {
            if (i >= p) as[i] += d;
            if (i <= p) bs[i] += d;
        }
    }

    writeln(as.to!(string[]).join(" "));
    writeln(bs.to!(string[]).join(" "));
}