s = input()

if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
    print('AMBIGUOUS')
elif 0 < int(s[:2]) <= 12 and int(s[2:]) >= 12:
    print('MMYY')
elif 0 < int(s[:2]) < 12 and int(s[2:]) == 0:
    print('MMYY')
elif int(s[:2]) >= 12 > 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
elif int(s[:2]) == 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
else:
    print('NA') s = input() s input() input if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
    print('AMBIGUOUS')
elif 0 < int(s[:2]) <= 12 and int(s[2:]) >= 12:
    print('MMYY')
elif 0 < int(s[:2]) < 12 and int(s[2:]) == 0:
    print('MMYY')
elif int(s[:2]) >= 12 > 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
elif int(s[:2]) == 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
else:
    print('NA') 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12 0 < int(s[:2]) <= 12 0 < int(s[:2]) 0 int(s[:2]) int s[:2] s :2 2 12 0 < int(s[2:]) <= 12 0 < int(s[2:]) 0 int(s[2:]) int s[2:] s 2: 2 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 0 < int(s[:2]) <= 12 and int(s[2:]) >= 12:
    print('MMYY') 0 < int(s[:2]) <= 12 and int(s[2:]) >= 12 0 < int(s[:2]) <= 12 0 < int(s[:2]) 0 int(s[:2]) int s[:2] s :2 2 12 int(s[2:]) >= 12 int(s[2:]) int s[2:] s 2: 2 12 print('MMYY') print 'MMYY' elif 0 < int(s[:2]) < 12 and int(s[2:]) == 0:
    print('MMYY') 0 < int(s[:2]) < 12 and int(s[2:]) == 0 0 < int(s[:2]) < 12 0 < int(s[:2]) 0 int(s[:2]) int s[:2] s :2 2 12 int(s[2:]) == 0 int(s[2:]) int s[2:] s 2: 2 0 print('MMYY') print 'MMYY' elif int(s[:2]) >= 12 > 0 and 0 < int(s[2:]) <= 12:
    print('YYMM') int(s[:2]) >= 12 > 0 and 0 < int(s[2:]) <= 12 int(s[:2]) >= 12 > 0 int(s[:2]) >= 12 int(s[:2]) int s[:2] s :2 2 12 0 0 < int(s[2:]) <= 12 0 < int(s[2:]) 0 int(s[2:]) int s[2:] s 2: 2 12 print('YYMM') print 'YYMM' elif int(s[:2]) == 0 and 0 < int(s[2:]) <= 12:
    print('YYMM') int(s[:2]) == 0 and 0 < int(s[2:]) <= 12 int(s[:2]) == 0 int(s[:2]) int s[:2] s :2 2 0 0 < int(s[2:]) <= 12 0 < int(s[2:]) 0 int(s[2:]) int s[2:] s 2: 2 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = input() input() s
s = input()

if 0 < int(s[:2]) <= 12 and 0 < int(s[2:]) <= 12:
    print('AMBIGUOUS')
elif 0 < int(s[:2]) <= 12 and int(s[2:]) >= 12:
    print('MMYY')
elif 0 < int(s[:2]) < 12 and int(s[2:]) == 0:
    print('MMYY')
elif int(s[:2]) >= 12 > 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
elif int(s[:2]) == 0 and 0 < int(s[2:]) <= 12:
    print('YYMM')
else:
    print('NA')