#!/usr/bin/env python3 #fileencoding: utf-8 N = int(input().strip()) a = [int(i) for i in input().strip().split(" ")] def headcount(H, L): x = 2*(H-1) - L//2 y = (H-1) - x return x, y end = False # x: cran, y: turtle for i in range(N-1): for j in range(i,N): x1, y1 = headcount(N, a[i]) x2, y2 = headcount(N, a[j]) x = x1 - x2 y = y1 - y2 if x == 1: print("%d %d"%(x2+1, y2)) end = True elif x == -1: print("%d %d"%(x1+1, y1)) end = True elif y == 1: print("%d %d"%(x2, y2+1)) end = True elif y == -1: print("%d %d"%(x1, y1+1)) end = True else: # x == 0 and y == 0 if x == 0 and x1*x2 != 0 and y == 0 and y1*y2 == 0: print("%d %d"%(x1+1, 0)) end = True elif x == 0 and x1*x2 == 0 and y == 0 and y1*y2 != 0: print("%d %d"%(0, y1+1)) end = True if end: break if end: break