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


for start in range(1,13):
    ok = True
    for a in range(len(tunnid)):
        if ((start + a - 1) % 12 + 1) not in tunnid:
            ok = False
    if ok == True:
        print("JAH")
        print(start,  (start + len(tunnid) - 2 ) % 12 + 1) 
        exit(0)

print("EI")
exit(0)
