import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
    print("NA")  
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM")
elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY")
elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS")  import sys sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip S = input() S input() input f = int(S[:2]) f int(S[:2]) int S[:2] S :2 2 s = int(S[2:]) s int(S[2:]) int S[2:] S 2: 2 if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
    print("NA")  
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM")
elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY")
elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS")  (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12) (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) (f <= 0 and s > 12) or (f > 12 and s <= 0) f <= 0 and s > 12 f <= 0 f 0 s > 12 s 12 f > 12 and s <= 0 f > 12 f 12 s <= 0 s 0 f <= 0 and s <= 0 f <= 0 f 0 s <= 0 s 0 f > 12 and s > 12 f > 12 f 12 s > 12 s 12 print("NA") print "NA" elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM") (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12) f > 12 and 0 < s <= 12 f > 12 f 12 0 < s <= 12 0 < s 0 s 12 f <= 0 and 0 < s <= 12 f <= 0 f 0 0 < s <= 12 0 < s 0 s 12 print("YYMM") print "YYMM" elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY") (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0) 0 < f <= 12 and s > 12 0 < f <= 12 0 < f 0 f 12 s > 12 s 12 0 < f <= 12 and s <= 0 0 < f <= 12 0 < f 0 f 12 s <= 0 s 0 print("MMYY") print "MMYY" elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS")  0 < f <= 12 and 0 < s <= 12 0 < f <= 12 0 < f 0 f 12 0 < s <= 12 0 < s 0 s 12 print("AMBIGUOUS") print "AMBIGUOUS" s = int(S[2:]) int(S[2:]) s f = int(S[:2]) int(S[:2]) f S = input() input() S input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input
import sys
input = lambda: sys.stdin.readline().rstrip()

S = input()

f = int(S[:2])
s = int(S[2:])

if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
    print("NA")  
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM")
elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY")
elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS") 