import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        String s = inp.next();
        if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.util.*; util.* java class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        String s = inp.next();
        if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    } main {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    } Scanner inp = new Scanner(System.in); inp new Scanner(System.in) do_(inp) do_ inp inp.close() inp.close inp String args[] args public static void do_(Scanner inp) {
        String s = inp.next();
        if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No");
    } do_ {
        String s = inp.next();
        if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No");
    } String s = inp.next(); s inp.next() inp.next inp if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No"); s.contains("AB") || s.contains("BA") s.contains("AB") s.contains s "AB" s.contains("BA") s.contains s "BA" System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" Scanner inp inp
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner inp = new Scanner(System.in);
        do_(inp);
        inp.close();
    }
    public static void do_(Scanner inp) {
        String s = inp.next();
        if (s.contains("AB") || s.contains("BA")) System.out.println("Yes");
        else System.out.println("No");
    }
}
