import datetime





def actual(s):

    try:

        is_valid_yymm = bool(datetime.datetime.strptime(s, '%y%m'))

    except ValueError:

        is_valid_yymm = False



    try:

        is_valid_mmyy = bool(datetime.datetime.strptime(s, '%m%y'))

    except ValueError:

        is_valid_mmyy = False



    if is_valid_yymm and is_valid_mmyy:

        return 'AMBIGUOUS'



    if is_valid_yymm and not is_valid_mmyy:

        return 'YYMM'



    if not is_valid_yymm and is_valid_mmyy:

        return 'MMYY'



    return 'NA'



s = eval(input())

print((actual(s)))
def actual(s):

    left, right = int(s[:2]), int(s[2:])



    valid_right_as_mm = 1 <= right <= 12

    valid_left_as_mm = 1 <= left <= 12



    if valid_left_as_mm and valid_right_as_mm:

        return 'AMBIGUOUS'



    if valid_left_as_mm:

        return 'MMYY'



    if valid_right_as_mm:

        return 'YYMM'



    return 'NA'



s = eval(input())

print((actual(s)))
import datetime


def actual(s):
    try:
        is_valid_yymm = bool(datetime.datetime.strptime(s, "%y%m"))
    except ValueError:
        is_valid_yymm = False
    try:
        is_valid_mmyy = bool(datetime.datetime.strptime(s, "%m%y"))
    except ValueError:
        is_valid_mmyy = False
    if is_valid_yymm and is_valid_mmyy:
        return "AMBIGUOUS"
    if is_valid_yymm and not is_valid_mmyy:
        return "YYMM"
    if not is_valid_yymm and is_valid_mmyy:
        return "MMYY"
    return "NA"


s = eval(input())
print((actual(s)))

def actual(s):
    left, right = int(s[:2]), int(s[2:])
    valid_right_as_mm = 1 <= right <= 12
    valid_left_as_mm = 1 <= left <= 12
    if valid_left_as_mm and valid_right_as_mm:
        return "AMBIGUOUS"
    if valid_left_as_mm:
        return "MMYY"
    if valid_right_as_mm:
        return "YYMM"
    return "NA"


s = eval(input())
print((actual(s)))

-import datetime - - -    try: -        is_valid_yymm = bool(datetime.datetime.strptime(s, "%y%m")) -    except ValueError: -        is_valid_yymm = False -    try: -        is_valid_mmyy = bool(datetime.datetime.strptime(s, "%m%y")) -    except ValueError: -        is_valid_mmyy = False -    if is_valid_yymm and is_valid_mmyy: +    left, right = int(s[:2]), int(s[2:]) +    valid_right_as_mm = 1 <= right <= 12 +    valid_left_as_mm = 1 <= left <= 12 +    if valid_left_as_mm and valid_right_as_mm: -    if is_valid_yymm and not is_valid_mmyy: +    if valid_left_as_mm: +        return "MMYY" +    if valid_right_as_mm: -    if not is_valid_yymm and is_valid_mmyy: -        return "MMYY"