let () =
    let main () =
        let s = int_of_string (read_line ()) in
        let i1 = s / 100 in
        let i2 = s mod 100 in
        let f1 = i2 >= 1 && i2 <= 12 in
        let f2 = i1 >= 1 && i1 <= 12 in

        let msg = match f1, f2 with
        | true,  true  -> "AMBIGUOUS"
        | false, false -> "NA"
        | true,  false -> "YYMM"
        | false, true  -> "MMYY"
        in
        print_endline msg
    in
    main ()