fun main (args : Array<String>) {
	val str1 = readLine()
	val str2 : String = str1.toString()
	var y : String = ""
	var m : String = ""
	var count : Int = 0
	for (i in str2) {
		if (count <= 1) {
			y += i
		} else {
			m += i
		}
		count++
	}
	return if ( (y.toInt() <= 12 && y.toInt() != 0) && (m.toInt() <= 12 && m.toInt() != 0) ) {
		println("AMBIGUOUS")
	} else if (m.toInt() <= 12 && m.toInt() != 0) {
		println("YYMM")
	} else if (y.toInt() <= 12 && y.toInt() != 0) {
		println("MMYY")
	} else {
		println("NA")
	}
}