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