n=input()

n1,n2=int(n[:2]),int(n[2:])
#if (n1>12 and n2>12) or (n1==0 and n2==0):
#   print("NA")
if (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA")


 n=input() n input() input n1,n2=int(n[:2]),int(n[2:]) n1 int(n[:2]) int n[:2] n :2 2 n2 int(n[2:]) int n[2:] n 2: 2 if (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA") (n1!=0 and n1<=12) and (n2!=0 and n2<=12) n1!=0 and n1<=12 n1!=0 n1 0 n1<=12 n1 12 n2!=0 and n2<=12 n2!=0 n2 0 n2<=12 n2 12 print("AMBIGUOUS") print "AMBIGUOUS" elif n1!=0 and n1<=12:
    print("MMYY") n1!=0 and n1<=12 n1!=0 n1 0 n1<=12 n1 12 print("MMYY") print "MMYY" elif n2!=0 and n2<=12:
    print("YYMM") n2!=0 and n2<=12 n2!=0 n2 0 n2<=12 n2 12 print("YYMM") print "YYMM" print("NA") print "NA" n=input() input() n n2=int(n[:2]),int(n[2:]) int(n[2:]) n2 n1,n2=int(n[:2]),int(n[2:]) int(n[:2]) n1
n=input()

n1,n2=int(n[:2]),int(n[2:])
#if (n1>12 and n2>12) or (n1==0 and n2==0):
#   print("NA")
if (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA")



