import itertools

import math

import fractions

import functools

import copy

s = eval(input())



front = int(s[0]+s[1])

back = int(s[2]+s[3])



if (1 <= front and front <= 12) and (1 <= back and back <= 12):

    print("AMBIGUOUS")

    quit()

if (1 <= front and front <= 12):

    print("MMYY")

    quit()

if (1 <= back and back <= 12):

    print("YYMM")

    quit()



print("NA")
import math





def main():

    # n = int(input())

    # n, k = map(int, input().split())

    # h = list(map(int, input().split()))

    s = eval(input())

    # h = [int(input()) for _ in rane(n)]

    f = int(s[:2])

    b = int(s[2:])

    if 1 <= f and f <= 12 and 1 <= b and b <= 12:

        print("AMBIGUOUS")

    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:

        print("YYMM")

    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:

        print("MMYY")

    else:

        print("NA")





if __name__ == '__main__':

    main()

import itertools
import math
import fractions
import functools
import copy

s = eval(input())
front = int(s[0] + s[1])
back = int(s[2] + s[3])
if (1 <= front and front <= 12) and (1 <= back and back <= 12):
    print("AMBIGUOUS")
    quit()
if 1 <= front and front <= 12:
    print("MMYY")
    quit()
if 1 <= back and back <= 12:
    print("YYMM")
    quit()
print("NA")

import math


def main():
    # n = int(input())
    # n, k = map(int, input().split())
    # h = list(map(int, input().split()))
    s = eval(input())
    # h = [int(input()) for _ in rane(n)]
    f = int(s[:2])
    b = int(s[2:])
    if 1 <= f and f <= 12 and 1 <= b and b <= 12:
        print("AMBIGUOUS")
    elif 0 <= f and f <= 99 and 1 <= b and b <= 12:
        print("YYMM")
    elif 0 <= b and b <= 99 and 1 <= f and f <= 12:
        print("MMYY")
    else:
        print("NA")


if __name__ == "__main__":
    main()

-import itertools -import fractions -import functools -import copy -s = eval(input()) -front = int(s[0] + s[1]) -back = int(s[2] + s[3]) -if (1 <= front and front <= 12) and (1 <= back and back <= 12): -    print("AMBIGUOUS") -    quit() -if 1 <= front and front <= 12: -    print("MMYY") -    quit() -if 1 <= back and back <= 12: -    print("YYMM") -    quit() -print("NA") + +def main(): +    # n = int(input()) +    # n, k = map(int, input().split()) +    # h = list(map(int, input().split())) +    s = eval(input()) +    # h = [int(input()) for _ in rane(n)] +    f = int(s[:2]) +    b = int(s[2:]) +    if 1 <= f and f <= 12 and 1 <= b and b <= 12: +        print("AMBIGUOUS") +    elif 0 <= f and f <= 99 and 1 <= b and b <= 12: +        print("YYMM") +    elif 0 <= b and b <= 99 and 1 <= f and f <= 12: +        print("MMYY") +    else: +        print("NA") + + +if __name__ == "__main__": +    main()