import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String p = scanner.nextLine();
        
        String custom_a = a + a;
        if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String p = scanner.nextLine();
        
        String custom_a = a + a;
        if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String p = scanner.nextLine();
        
        String custom_a = a + a;
        if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        }
    } main {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String p = scanner.nextLine();
        
        String custom_a = a + a;
        if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String a = scanner.nextLine(); a scanner.nextLine() scanner.nextLine scanner String p = scanner.nextLine(); p scanner.nextLine() scanner.nextLine scanner String custom_a = a + a; custom_a a + a a a if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        } custom_a.indexOf(p) != -1 custom_a.indexOf(p) custom_a.indexOf custom_a p -1 1 {
            System.out.println("Yes");  
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        String a = scanner.nextLine();
        String p = scanner.nextLine();
        
        String custom_a = a + a;
        if(custom_a.indexOf(p) != -1){
            System.out.println("Yes");  
        } else {
            System.out.println("No");
        }
    }
}
