import sys

input = sys.stdin.readline

s = eval(input())

s1 = int(s[:2])

s2 = int(s[2:])

isS1MM = 1 <= s1 <= 12

isS2MM = 1 <= s2 <= 12

if isS1MM and isS2MM:

    print("AMBIGUOUS")

elif not isS1MM and isS2MM:

    print("YYMM")

elif isS1MM and not isS2MM:

    print("MMYY")

else:

    print('NA')
import sys

input = sys.stdin.readline

s = eval(input())

s1 = int(s[:2])

s2 = int(s[2:])

isS1YYMM = 1 <= s1 <= 12

isS2MMYY = 1 <= s2 <= 12

if isS1YYMM:

    if isS2MMYY:

        print("AMBIGUOUS")

    else:

        print("MMYY")

else:

    if isS2MMYY:

        print("YYMM")

    else:

        print('NA')
import sys

input = sys.stdin.readline
s = eval(input())
s1 = int(s[:2])
s2 = int(s[2:])
isS1MM = 1 <= s1 <= 12
isS2MM = 1 <= s2 <= 12
if isS1MM and isS2MM:
    print("AMBIGUOUS")
elif not isS1MM and isS2MM:
    print("YYMM")
elif isS1MM and not isS2MM:
    print("MMYY")
else:
    print("NA")

import sys

input = sys.stdin.readline
s = eval(input())
s1 = int(s[:2])
s2 = int(s[2:])
isS1YYMM = 1 <= s1 <= 12
isS2MMYY = 1 <= s2 <= 12
if isS1YYMM:
    if isS2MMYY:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if isS2MMYY:
        print("YYMM")
    else:
        print("NA")

-isS1MM = 1 <= s1 <= 12 -isS2MM = 1 <= s2 <= 12 -if isS1MM and isS2MM: -    print("AMBIGUOUS") -elif not isS1MM and isS2MM: -    print("YYMM") -elif isS1MM and not isS2MM: -    print("MMYY") +isS1YYMM = 1 <= s1 <= 12 +isS2MMYY = 1 <= s2 <= 12 +if isS1YYMM: +    if isS2MMYY: +        print("AMBIGUOUS") +    else: +        print("MMYY") -    print("NA") +    if isS2MMYY: +        print("YYMM") +    else: +        print("NA")