let arr=readLine()!

 let characters = arr.characters

var c = 0
var o1 = ""
var o2 = ""
var p : String = ""
for var s in characters {

        if( c < 2 ) {
        p = String(s)
        o1 += p
    } else {
                p = String(s)
        o2 += p
        }
        c += 1
}

var x : Int = Int( o1 )!
var y : Int = Int( o2 )!

if( ( ( x > 0 ) || ( x <= 12 ) ) && ( ( y < 1 ) || ( y > 12 ) ) ) {
  print( "MMYY" )
} else if( ( ( x > 12 || x < 1 ) ) && ( ( y <= 12  ) || ( y < 1 ) ) ) {
  print( "YYMM" )
} else if( ( ( x > 1 ) || ( x <= 12 ) ) && ( ( y >= 12 ) || ( y < 1 ) ) ) {
  print( "AMBIGUOUS" )
} else {
  print( "NA" )
}
 