s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
if x != y:
    print(x + y)
else:
    print("NA" if x == "YY" else "AMBIGUOUS") s = int(input()) s int(input()) int input() input a, b = s // 100, s % 100 a s // 100 s 100 b s % 100 s 100 x = "YY" if a == 0 or a > 12 else "MM" x "YY" if a == 0 or a > 12 else "MM" a == 0 or a > 12 a == 0 a 0 a > 12 a 12 "YY" "MM" y = "YY" if b == 0 or b > 12 else "MM" y "YY" if b == 0 or b > 12 else "MM" b == 0 or b > 12 b == 0 b 0 b > 12 b 12 "YY" "MM" if x != y:
    print(x + y)
else:
    print("NA" if x == "YY" else "AMBIGUOUS") x != y x y print(x + y) print x + y x y print("NA" if x == "YY" else "AMBIGUOUS") print "NA" if x == "YY" else "AMBIGUOUS" x == "YY" x "YY" "NA" "AMBIGUOUS" x = "YY" if a == 0 or a > 12 else "MM" "YY" if a == 0 or a > 12 else "MM" x y = "YY" if b == 0 or b > 12 else "MM" "YY" if b == 0 or b > 12 else "MM" y s = int(input()) int(input()) s a, b = s // 100, s % 100 s // 100 a b = s // 100, s % 100 s % 100 b
s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
if x != y:
    print(x + y)
else:
    print("NA" if x == "YY" else "AMBIGUOUS")
