import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        String a = scan.nextLine();
        String b = scan.nextLine();
        String a2 = a + a;
        
        if(a2.contains(b)){
            
            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 scan = new Scanner(System.in);
        
        String a = scan.nextLine();
        String b = scan.nextLine();
        String a2 = a + a;
        
        if(a2.contains(b)){
            
            System.out.println("Yes");
            
        }else{
        
            System.out.println("No");
            
        }
        
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        
        String a = scan.nextLine();
        String b = scan.nextLine();
        String a2 = a + a;
        
        if(a2.contains(b)){
            
            System.out.println("Yes");
            
        }else{
        
            System.out.println("No");
            
        }
        
    } main {
        Scanner scan = new Scanner(System.in);
        
        String a = scan.nextLine();
        String b = scan.nextLine();
        String a2 = a + a;
        
        if(a2.contains(b)){
            
            System.out.println("Yes");
            
        }else{
        
            System.out.println("No");
            
        }
        
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String a = scan.nextLine(); a scan.nextLine() scan.nextLine scan String b = scan.nextLine(); b scan.nextLine() scan.nextLine scan String a2 = a + a; a2 a + a a a if(a2.contains(b)){
            
            System.out.println("Yes");
            
        }else{
        
            System.out.println("No");
            
        } a2.contains(b) a2.contains a2 b {
            
            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 scan = new Scanner(System.in);
        
        String a = scan.nextLine();
        String b = scan.nextLine();
        String a2 = a + a;
        
        if(a2.contains(b)){
            
            System.out.println("Yes");
            
        }else{
        
            System.out.println("No");
            
        }
        
    }
}
