s = input()
s1 = int(s[0:2])
s2 = int(s[2:])

if s1 > 0 and s1 < 13:
    if s2 > 0 and s2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s2 > 0 and s2 < 13:
        print("YYMM")
    else:
        print("NA") s = input() s input() input s1 = int(s[0:2]) s1 int(s[0:2]) int s[0:2] s 0:2 0 2 s2 = int(s[2:]) s2 int(s[2:]) int s[2:] s 2: 2 if s1 > 0 and s1 < 13:
    if s2 > 0 and s2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s2 > 0 and s2 < 13:
        print("YYMM")
    else:
        print("NA") s1 > 0 and s1 < 13 s1 > 0 s1 0 s1 < 13 s1 13 if s2 > 0 and s2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY") s2 > 0 and s2 < 13 s2 > 0 s2 0 s2 < 13 s2 13 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if s2 > 0 and s2 < 13:
        print("YYMM")
    else:
        print("NA") s2 > 0 and s2 < 13 s2 > 0 s2 0 s2 < 13 s2 13 print("YYMM") print "YYMM" print("NA") print "NA" s = input() input() s s1 = int(s[0:2]) int(s[0:2]) s1 s2 = int(s[2:]) int(s[2:]) s2
s = input()
s1 = int(s[0:2])
s2 = int(s[2:])

if s1 > 0 and s1 < 13:
    if s2 > 0 and s2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s2 > 0 and s2 < 13:
        print("YYMM")
    else:
        print("NA")