s = str(input())
A = int(s[0:2]); B = int(s[2:4])
if 1 <= A <= 12 and 1 <= B <= 12:
    print("AMBIGUOUS")
elif 1 <= A <= 12 and 0 <= B <= 99:
    print("MMYY")
elif 1 <= B <= 12 and 0 <= A <= 99:
    print("YYMM")
else:
    print("NA") s = str(input()) s str(input()) str input() input A = int(s[0:2]) A int(s[0:2]) int s[0:2] s 0:2 0 2 B = int(s[2:4]) B int(s[2:4]) int s[2:4] s 2:4 2 4 if 1 <= A <= 12 and 1 <= B <= 12:
    print("AMBIGUOUS")
elif 1 <= A <= 12 and 0 <= B <= 99:
    print("MMYY")
elif 1 <= B <= 12 and 0 <= A <= 99:
    print("YYMM")
else:
    print("NA") 1 <= A <= 12 and 1 <= B <= 12 1 <= A <= 12 1 <= A 1 A 12 1 <= B <= 12 1 <= B 1 B 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1 <= A <= 12 and 0 <= B <= 99:
    print("MMYY") 1 <= A <= 12 and 0 <= B <= 99 1 <= A <= 12 1 <= A 1 A 12 0 <= B <= 99 0 <= B 0 B 99 print("MMYY") print "MMYY" elif 1 <= B <= 12 and 0 <= A <= 99:
    print("YYMM") 1 <= B <= 12 and 0 <= A <= 99 1 <= B <= 12 1 <= B 1 B 12 0 <= A <= 99 0 <= A 0 A 99 print("YYMM") print "YYMM" print("NA") print "NA" B = int(s[2:4]) int(s[2:4]) B A = int(s[0:2]) int(s[0:2]) A s = str(input()) str(input()) s
s = str(input())
A = int(s[0:2]); B = int(s[2:4])
if 1 <= A <= 12 and 1 <= B <= 12:
    print("AMBIGUOUS")
elif 1 <= A <= 12 and 0 <= B <= 99:
    print("MMYY")
elif 1 <= B <= 12 and 0 <= A <= 99:
    print("YYMM")
else:
    print("NA")