n = int(input()) a = list(map(int,input().split())) c = n for i in reversed(a): print(i, c) if i == c: c -= 1 print(c)