S = input()

former = int(S[:2])
latter = int(S[2:])

if((former >= 13 or former == 0) and 1 <= latter <= 12):
    print("YYMM")
if((latter >= 13 or latter == 0) and 1 <= former <= 12):
    print("MMYY")
if(1 <= former <= 12 and 1 <= latter <= 12):
    print("AMBIGUOUS")
if((former >= 13 or former == 0) and (latter >= 13 or latter == 0)):
    print("NA") S = input() S input() input former = int(S[:2]) former int(S[:2]) int S[:2] S :2 2 latter = int(S[2:]) latter int(S[2:]) int S[2:] S 2: 2 if((former >= 13 or former == 0) and 1 <= latter <= 12):
    print("YYMM") (former >= 13 or former == 0) and 1 <= latter <= 12 former >= 13 or former == 0 former >= 13 former 13 former == 0 former 0 1 <= latter <= 12 1 <= latter 1 latter 12 print("YYMM") print "YYMM" if((latter >= 13 or latter == 0) and 1 <= former <= 12):
    print("MMYY") (latter >= 13 or latter == 0) and 1 <= former <= 12 latter >= 13 or latter == 0 latter >= 13 latter 13 latter == 0 latter 0 1 <= former <= 12 1 <= former 1 former 12 print("MMYY") print "MMYY" if(1 <= former <= 12 and 1 <= latter <= 12):
    print("AMBIGUOUS") 1 <= former <= 12 and 1 <= latter <= 12 1 <= former <= 12 1 <= former 1 former 12 1 <= latter <= 12 1 <= latter 1 latter 12 print("AMBIGUOUS") print "AMBIGUOUS" if((former >= 13 or former == 0) and (latter >= 13 or latter == 0)):
    print("NA") (former >= 13 or former == 0) and (latter >= 13 or latter == 0) former >= 13 or former == 0 former >= 13 former 13 former == 0 former 0 latter >= 13 or latter == 0 latter >= 13 latter 13 latter == 0 latter 0 print("NA") print "NA" latter = int(S[2:]) int(S[2:]) latter former = int(S[:2]) int(S[:2]) former S = input() input() S
S = input()

former = int(S[:2])
latter = int(S[2:])

if((former >= 13 or former == 0) and 1 <= latter <= 12):
    print("YYMM")
if((latter >= 13 or latter == 0) and 1 <= former <= 12):
    print("MMYY")
if(1 <= former <= 12 and 1 <= latter <= 12):
    print("AMBIGUOUS")
if((former >= 13 or former == 0) and (latter >= 13 or latter == 0)):
    print("NA")