
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str =  sc.nextLine();
        System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str =  sc.nextLine();
        System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str =  sc.nextLine();
        System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No");
    } main {
        Scanner sc = new Scanner(System.in);
        String str =  sc.nextLine();
        System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str =  sc.nextLine(); str sc.nextLine() sc.nextLine sc System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No") System.out.println System.out System System.out str.matches(".*AB.*|.*BA.*")?"Yes":"No" str.matches(".*AB.*|.*BA.*") str.matches str ".*AB.*|.*BA.*" "Yes" "No" String[] args args

import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str =  sc.nextLine();
        System.out.println( str.matches(".*AB.*|.*BA.*")?"Yes":"No");
    }
}