a, b = divmod(int(input()), 100)
x = "MM" if 0 < a < 13 else "YY"
y = "MM" if 0 < b < 13 else "YY"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS") a, b = divmod(int(input()), 100) a divmod(int(input()), 100) divmod int(input()) int input() input 100 b x = "MM" if 0 < a < 13 else "YY" x "MM" if 0 < a < 13 else "YY" 0 < a < 13 0 < a 0 a 13 "MM" "YY" y = "MM" if 0 < b < 13 else "YY" y "MM" if 0 < b < 13 else "YY" 0 < b < 13 0 < b 0 b 13 "MM" "YY" print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS") print x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS" x != y x y x + y x y "NA" if x == "YY" else "AMBIGUOUS" x == "YY" x "YY" "NA" "AMBIGUOUS" x = "MM" if 0 < a < 13 else "YY" "MM" if 0 < a < 13 else "YY" x y = "MM" if 0 < b < 13 else "YY" "MM" if 0 < b < 13 else "YY" y a, b = divmod(int(input()), 100) divmod(int(input()), 100) a b = divmod(int(input()), 100) divmod(int(input()), 100) b
a, b = divmod(int(input()), 100)
x = "MM" if 0 < a < 13 else "YY"
y = "MM" if 0 < b < 13 else "YY"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS")
