import java.util.*;
 
public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} import java.util.*; util.* java public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String text=""; text "" String target=""; target "" text=scan.nextLine() text scan.nextLine() scan.nextLine scan target=scan.nextLine() target scan.nextLine() scan.nextLine scan text=text+text text text+text text text int index=text.indexOf(target); index text.indexOf(target) text.indexOf text target if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } index!=-1 index -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 public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;
 
public class Main {
    
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        
        String text="";
        String target="";
        text=scan.nextLine();
        target=scan.nextLine();
        
        text=text+text;
        int index=text.indexOf(target);
        if(index!=-1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}