function Main(input) {
    if ( input.match(/AB/)) {
        console.log("Yes")
    }else if( input.match(/BA/)){
        console.log("Yes")
    }else{
        console.log("No")
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));