import java.io.*;

public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    }

        
} import java.io.*; io.* java public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    }

        
} Main public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br String ans=null; ans null String res=null; res null for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        } {
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        } if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            } i+p.length() <=s.length() i+p.length() i p.length() p.length p s.length() s.length s {
                ans=s.substring(i, i+p.length());
            } ans=s.substring(i, i+p.length()) ans s.substring(i, i+p.length()) s.substring s i i+p.length() i p.length() p.length p {
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            } ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i)) ans s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i)) s.substring(i , s.length()) s.substring s i s.length() s.length s s.substring(0 , p.length()-(s.length()-i)) s.substring s 0 p.length()-(s.length()-i) p.length() p.length p (s.length()-i) s.length() s.length s i if(p.equals(ans)){
                res="Yes";
                break;
            } p.equals(ans) p.equals p ans {
                res="Yes";
                break;
            } res="Yes" res "Yes" break; if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        } res=="Yes" res "Yes" {
            System.out.println(res);
        } System.out.println(res) System.out.println System.out System System.out res {
            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) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    }

        
} public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    }

        
} Main
import java.io.*;

public class Main{
    public static void main(String[]args) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        String p = br.readLine();
        String ans=null;
        String res=null;
        for(int i=0;i<s.length();i++){
            if(i+p.length() <=s.length()){
                ans=s.substring(i, i+p.length());
            }else{
                ans=s.substring(i , s.length())+s.substring(0 , p.length()-(s.length()-i));
            }
            if(p.equals(ans)){
                res="Yes";
                break;
            }
                    
        }
        if(res=="Yes"){
            System.out.println(res);
        }else{
            System.out.println("No");
        }
 
        
    }

        
}