import re

s = input()


def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
    

def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match)


if is_valid_yymm(s) and is_valid_mmyy(s):
    print('AMBIGUOUS')
elif is_valid_yymm(s):
    print('YYMM')
elif is_valid_mmyy(s):
    print('MMYY')
else:
    print('NA') import re re s = input() s input() input def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
     is_valid_yymm match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s) match re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s) re.search re search '^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$' s return bool(match) bool(match) bool match s s def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match) is_valid_mmyy match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s) match re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s) re.search re search '^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$' s return bool(match) bool(match) bool match s s if is_valid_yymm(s) and is_valid_mmyy(s):
    print('AMBIGUOUS')
elif is_valid_yymm(s):
    print('YYMM')
elif is_valid_mmyy(s):
    print('MMYY')
else:
    print('NA') is_valid_yymm(s) and is_valid_mmyy(s) is_valid_yymm(s) is_valid_yymm s is_valid_mmyy(s) is_valid_mmyy s print('AMBIGUOUS') print 'AMBIGUOUS' elif is_valid_yymm(s):
    print('YYMM') is_valid_yymm(s) is_valid_yymm s print('YYMM') print 'YYMM' elif is_valid_mmyy(s):
    print('MMYY') is_valid_mmyy(s) is_valid_mmyy s print('MMYY') print 'MMYY' print('NA') print 'NA' def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
     def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
     is_valid_yymm s = input() input() s def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match) def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match) is_valid_mmyy
import re

s = input()


def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
    

def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match)


if is_valid_yymm(s) and is_valid_mmyy(s):
    print('AMBIGUOUS')
elif is_valid_yymm(s):
    print('YYMM')
elif is_valid_mmyy(s):
    print('MMYY')
else:
    print('NA')
