S = input()
a = S[0:2]
b = S[2:4]

def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


if is_month(a) and is_month(b):
    print("AMBIGUOUS")
elif is_month(a) and is_month(b) == False:
    print("MMYY")
elif is_month(a) == False and is_month(b):
    print("YYMM")
else:
    print("NA")
f431cd1d2e76a124373b39569c3c281815f199d0
<mask token>

<mask token>


def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


<mask token>

<mask token>


def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


if is_month(a) and is_month(b):
    print('AMBIGUOUS')
elif is_month(a) and is_month(b) == False:
    print('MMYY')
elif is_month(a) == False and is_month(b):
    print('YYMM')
else:
    print('NA')

S = input()
a = S[0:2]
b = S[2:4]


def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


if is_month(a) and is_month(b):
    print('AMBIGUOUS')
elif is_month(a) and is_month(b) == False:
    print('MMYY')
elif is_month(a) == False and is_month(b):
    print('YYMM')
else:
    print('NA')

S = input()
a = S[0:2]
b = S[2:4]

def is_month(s):
    if 1 <= int(s) <= 12:
        return True
    else:
        return False


if is_month(a) and is_month(b):
    print("AMBIGUOUS")
elif is_month(a) and is_month(b) == False:
    print("MMYY")
elif is_month(a) == False and is_month(b):
    print("YYMM")
else:
    print("NA")