import copy


n=int(input())
a = [0] * n
c = [0] * n

for i in range(n):
  a[i]=int(input())
  
b = copy.deepcopy(a)
  
b = list(set(b))
list.sort(b, reverse=True)

for i in range(len(b)):
  c[i] = b.count(a)

print(a)
print(b)
print(c)

if n == 2:
  print(a[1])
  print(a[0])
  
else:
  for i in range(n):
    for j in range(len(b)):
      if a[i] < b[j]:
        print(i,b[j])
        break
      elif a[i] == b[j] and c[j] == 0:
        print(i,b[j+1])
        break
      