let n = read_int ()

let a = Array.make n 0

let rec read_ints = function
  | 0 -> ()
  | k -> (Scanf.scanf " %d" (fun x -> a.(x-1) <- n-k)); read_ints (k-1)

let ps = read_ints n

let base = n*n+1

let rec solvea i = if i = n then () else begin Printf.printf " %d" ((i+1)*n + base + a.(i)); solvea (i+1) end

let rec solveb i = if i = n then () else begin Printf.printf " %d" (-(i+1)*n + base); solveb (i+1) end

let () = begin solvea 0; print_newline (); solveb 0 end