import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()

a = 10*S[0]+S[1]
b = 10*S[2]+S[3]

if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif not 1 <= a <= 12:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')
else:
    print('MMYY')
 import sys sys def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし LI2 S = LI2() S LI2() LI2 a = 10*S[0]+S[1] a 10*S[0]+S[1] 10*S[0] 10 S[0] S 0 S[1] S 1 b = 10*S[2]+S[3] b 10*S[2]+S[3] 10*S[2] 10 S[2] S 2 S[3] S 3 if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif not 1 <= a <= 12:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')
else:
    print('MMYY') 1 <= a <= 12 and 1 <= b <= 12 1 <= a <= 12 1 <= a 1 a 12 1 <= b <= 12 1 <= b 1 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif not 1 <= a <= 12:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA') not 1 <= a <= 12 1 <= a <= 12 1 <= a 1 a 12 if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA') 1 <= b <= 12 1 <= b 1 b 12 print('YYMM') print 'YYMM' print('NA') print 'NA' print('MMYY') print 'MMYY' def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし LI2 S = LI2() LI2() S b = 10*S[2]+S[3] 10*S[2]+S[3] b a = 10*S[0]+S[1] 10*S[0]+S[1] a
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし

S = LI2()

a = 10*S[0]+S[1]
b = 10*S[2]+S[3]

if 1 <= a <= 12 and 1 <= b <= 12:
    print('AMBIGUOUS')
elif not 1 <= a <= 12:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')
else:
    print('MMYY')

