import Foundation
let S = readLine()!

let first = Int(S.substring(with: NSRange(location: 0, length: 2)))
let second = Int(S.substring(with: NSRange(location: 2, length: 2)))

if let f = first, let s = second, 1...12 ~= f || 1...12 ~= s  {
  if f > 12 {
    print("YYMM")
  } else if s > 12 {
    print("MMYY")
  } else {
    print("AMBIGUOUS")
  }
} else {
  print("NA")
}
