#include<stdio.h>
int main(void){
  char *s="python3 -c \""
  "a=range(1,8**5*int(input())+1,8**5);*b,=a[::-1];print(*a)\n"
  "for t,i in enumerate(input().split()):b[int(i)-1]+=t\n"
  "print(*b)\"";
  system(s);
  return 0;
}