import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
} 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 str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
} Main public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str1; str1 String str2; str2 str1 = br.readLine() str1 br.readLine() br.readLine br str1 += str1 str1 str1 str2 = br.readLine() str2 br.readLine() br.readLine br if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        } str1.indexOf(str2) == -1 str1.indexOf(str2) str1.indexOf str1 str2 -1 1 {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
} public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
} Main
import java.io.*;

public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str1;
        String str2;
        
        str1 = br.readLine();
        str1 += str1;

        str2 = br.readLine();
        
        if(str1.indexOf(str2) == -1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }
        
    }
}