local n = io.read("*n")
local a, b = {}, {}
for i = 1, n do
  a[i] = 30000 * i
  b[i] = 30000 * (n + 1 - i)
end
for i = 1, n do
  local p = io.read("*n")
  a[p] = a[p] + i
end
print(table.concat(a, " "))
print(table.concat(b, " "))
