fun main(args: Array<String>) {

    val num = readLine()!!.toString()

    val firstAndSecond = Integer.parseInt(num.take(2))
    val thirdAndFourth = Integer.parseInt(num.takeLast(2))
    var isMM__ = false
    var is__MM = false

    if ((firstAndSecond >= 1) && (firstAndSecond <= 12)) {
        isMM__ = true
    }

    if ((thirdAndFourth >= 1) && (thirdAndFourth <= 12)) {
        is__MM = true
    }

    if (isMM__ && is__MM) {
        print("AMBIGUOUS")
        return
    }

    if (isMM__ && !is__MM) {
        print("MMYY")
        return
    }

    if (!isMM__ && is__MM) {
        print("YYMM")
        return
    }
    if (!isMM__ && !is__MM) {
        print("NA")
        return
    }
    if ((firstAndSecond == 0) && is__MM) {
        print("YYMM")
    }

    if ((thirdAndFourth == 0) && isMM__) {
        print("MMYY")
    }

}

