s = input().rstrip()

a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif (a == 0 or 13 <= a <= 99) and 1 <= b <= 12:
    print("YYMM")
elif 1 <= a <= 12 and (b == 0 or 13 <= b <= 99):
    print("MMYY")
else:
    print("NA") s = input().rstrip() s input().rstrip() ().rstrip () input rstrip a = int(s[:2]) a int(s[:2]) int s[:2] s :2 2 b = int(s[2:]) b int(s[2:]) int s[2:] s 2: 2 if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif (a == 0 or 13 <= a <= 99) and 1 <= b <= 12:
    print("YYMM")
elif 1 <= a <= 12 and (b == 0 or 13 <= b <= 99):
    print("MMYY")
else:
    print("NA") 1 <= a <= 12 and 1 <= b <= 12 1 <= a <= 12 1 <= a 1 a 12 1 <= b <= 12 1 <= b 1 b 12 print("AMBIGUOUS") print "AMBIGUOUS" elif (a == 0 or 13 <= a <= 99) and 1 <= b <= 12:
    print("YYMM") (a == 0 or 13 <= a <= 99) and 1 <= b <= 12 a == 0 or 13 <= a <= 99 a == 0 a 0 13 <= a <= 99 13 <= a 13 a 99 1 <= b <= 12 1 <= b 1 b 12 print("YYMM") print "YYMM" elif 1 <= a <= 12 and (b == 0 or 13 <= b <= 99):
    print("MMYY") 1 <= a <= 12 and (b == 0 or 13 <= b <= 99) 1 <= a <= 12 1 <= a 1 a 12 b == 0 or 13 <= b <= 99 b == 0 b 0 13 <= b <= 99 13 <= b 13 b 99 print("MMYY") print "MMYY" print("NA") print "NA" s = input().rstrip() input().rstrip() s a = int(s[:2]) int(s[:2]) a b = int(s[2:]) int(s[2:]) b
s = input().rstrip()

a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif (a == 0 or 13 <= a <= 99) and 1 <= b <= 12:
    print("YYMM")
elif 1 <= a <= 12 and (b == 0 or 13 <= b <= 99):
    print("MMYY")
else:
    print("NA")