
n = int(input())
tunnid = set(map(int, input().split(' ')))


if (max(tunnid) - min(tunnid) + 1 == len(tunnid)):
        print("JAH")
        print(min(tunnid), max(tunnid))
        exit(0)

t2 = set(range(1,13))  - tunnid
if (max(t2) - min(t2) + 1 == len(t2)):
    start = max(t2) + 1
    end = min(t2) - 1
    if start == 13:     
        start = 1
    if end == 0:
        end = 12
    print("JAH")
    print(start,end)
    exit(0)
    

print("EI")
exit(0)
