S = input()
head = S[:2]
tail = S[2:]

MMYY = False
YYMM = False

if 1 <= int(head) <= 12:
    MMYY = True
if 1 <= int(tail) <= 12:
    YYMM = True

if MMYY and YYMM:
    print("AMBIGUOUS")
elif MMYY:
    print("MMYY")
elif YYMM:
    print("YYMM")
else:
    print("NA")
 S = input() S input() input head = S[:2] head S[:2] S :2 2 tail = S[2:] tail S[2:] S 2: 2 MMYY = False MMYY False YYMM = False YYMM False if 1 <= int(head) <= 12:
    MMYY = True 1 <= int(head) <= 12 1 <= int(head) 1 int(head) int head 12 MMYY = True MMYY True if 1 <= int(tail) <= 12:
    YYMM = True 1 <= int(tail) <= 12 1 <= int(tail) 1 int(tail) int tail 12 YYMM = True YYMM True if MMYY and YYMM:
    print("AMBIGUOUS")
elif MMYY:
    print("MMYY")
elif YYMM:
    print("YYMM")
else:
    print("NA") MMYY and YYMM MMYY YYMM print("AMBIGUOUS") print "AMBIGUOUS" elif MMYY:
    print("MMYY") MMYY print("MMYY") print "MMYY" elif YYMM:
    print("YYMM") YYMM print("YYMM") print "YYMM" print("NA") print "NA" MMYY = False False MMYY tail = S[2:] S[2:] tail S = input() input() S YYMM = False False YYMM head = S[:2] S[:2] head MMYY = True True MMYY YYMM = True True YYMM
S = input()
head = S[:2]
tail = S[2:]

MMYY = False
YYMM = False

if 1 <= int(head) <= 12:
    MMYY = True
if 1 <= int(tail) <= 12:
    YYMM = True

if MMYY and YYMM:
    print("AMBIGUOUS")
elif MMYY:
    print("MMYY")
elif YYMM:
    print("YYMM")
else:
    print("NA")

