[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let isYYMM a b = 0 <= a && a <= 99 && 1 <= b && b <= 12
let isMMYY a b = isYYMM b a

[<EntryPoint>]
let main _ =
    let s = read string
    let a = s.Substring(0, 2) |> int
    let b = s.Substring(2, 2) |> int
    match (isYYMM a b, isMMYY a b) with
    | (true, true) -> "AMBIGUOUS"
    | (true, false) -> "YYMM"
    | (false, true) -> "MMYY"
    | _ -> "NA"
    |> printfn "%s"
    0