#!/usr/bin/env python

S = input()

yy = int(S[0:2])
mm = int(S[2:])

yymm = False
mmyy = False

if yy > 0 and yy < 13:
    mmyy = True
if mm > 0 and mm < 13:
    yymm = True

if yymm and mmyy :
    print("AMBIGUOUS")
elif yymm and not mmyy:
    print("YYMM")
elif not yymm and mmyy:
    print("MMYY")
else:
    print("NA") S = input() S input() input yy = int(S[0:2]) yy int(S[0:2]) int S[0:2] S 0:2 0 2 mm = int(S[2:]) mm int(S[2:]) int S[2:] S 2: 2 yymm = False yymm False mmyy = False mmyy False if yy > 0 and yy < 13:
    mmyy = True yy > 0 and yy < 13 yy > 0 yy 0 yy < 13 yy 13 mmyy = True mmyy True if mm > 0 and mm < 13:
    yymm = True mm > 0 and mm < 13 mm > 0 mm 0 mm < 13 mm 13 yymm = True yymm True if yymm and mmyy :
    print("AMBIGUOUS")
elif yymm and not mmyy:
    print("YYMM")
elif not yymm and mmyy:
    print("MMYY")
else:
    print("NA") yymm and mmyy yymm mmyy print("AMBIGUOUS") print "AMBIGUOUS" elif yymm and not mmyy:
    print("YYMM") yymm and not mmyy yymm not mmyy mmyy print("YYMM") print "YYMM" elif not yymm and mmyy:
    print("MMYY") not yymm and mmyy not yymm yymm mmyy print("MMYY") print "MMYY" print("NA") print "NA" mmyy = False False mmyy S = input() input() S yymm = False False yymm mm = int(S[2:]) int(S[2:]) mm mmyy = True True mmyy yy = int(S[0:2]) int(S[0:2]) yy yymm = True True yymm
#!/usr/bin/env python

S = input()

yy = int(S[0:2])
mm = int(S[2:])

yymm = False
mmyy = False

if yy > 0 and yy < 13:
    mmyy = True
if mm > 0 and mm < 13:
    yymm = True

if yymm and mmyy :
    print("AMBIGUOUS")
elif yymm and not mmyy:
    print("YYMM")
elif not yymm and mmyy:
    print("MMYY")
else:
    print("NA")
