s = str(input())
num = ['01','02','03','04','05','06','07','08','09','10','11','12']
if s[:2] in num and s[2:] in num:
    print("AMBIGUOUS")
elif s[:2] in num:
    print("MMYY")
elif s[2:] in num:
    print("YYMM")
else:
    print("NA") s = str(input()) s str(input()) str input() input num = ['01','02','03','04','05','06','07','08','09','10','11','12'] num ['01','02','03','04','05','06','07','08','09','10','11','12'] '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' if s[:2] in num and s[2:] in num:
    print("AMBIGUOUS")
elif s[:2] in num:
    print("MMYY")
elif s[2:] in num:
    print("YYMM")
else:
    print("NA") s[:2] in num and s[2:] in num s[:2] in num s[:2] s :2 2 num s[2:] in num s[2:] s 2: 2 num print("AMBIGUOUS") print "AMBIGUOUS" elif s[:2] in num:
    print("MMYY") s[:2] in num s[:2] s :2 2 num print("MMYY") print "MMYY" elif s[2:] in num:
    print("YYMM") s[2:] in num s[2:] s 2: 2 num print("YYMM") print "YYMM" print("NA") print "NA" s = str(input()) str(input()) s num = ['01','02','03','04','05','06','07','08','09','10','11','12'] ['01','02','03','04','05','06','07','08','09','10','11','12'] num
s = str(input())
num = ['01','02','03','04','05','06','07','08','09','10','11','12']
if s[:2] in num and s[2:] in num:
    print("AMBIGUOUS")
elif s[:2] in num:
    print("MMYY")
elif s[2:] in num:
    print("YYMM")
else:
    print("NA")