//import java.util.Scanner;
import java.io.*;

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

        if(s.indexOf(p) != -1){
        System.out.println("Yes");
        }      
        else{
        System.out.println("No");
        }
    }
} import java.io.*; io.* java class Main {
    public static void main(String[] args)throws IOException{ 
    	InputStreamReader in = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(in);
    	   	                                                 
    	String s = reader.readLine();
        String p = reader.readLine();        
        s = s + s;

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

        if(s.indexOf(p) != -1){
        System.out.println("Yes");
        }      
        else{
        System.out.println("No");
        }
    } main { 
    	InputStreamReader in = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(in);
    	   	                                                 
    	String s = reader.readLine();
        String p = reader.readLine();        
        s = s + s;

        if(s.indexOf(p) != -1){
        System.out.println("Yes");
        }      
        else{
        System.out.println("No");
        }
    } InputStreamReader in = new InputStreamReader(System.in); in new InputStreamReader(System.in) BufferedReader reader = new BufferedReader(in); reader new BufferedReader(in) String s = reader.readLine(); s reader.readLine() reader.readLine reader String p = reader.readLine(); p reader.readLine() reader.readLine reader s = s + s s s + s s s if(s.indexOf(p) != -1){
        System.out.println("Yes");
        }      
        else{
        System.out.println("No");
        } s.indexOf(p) != -1 s.indexOf(p) s.indexOf s 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;
import java.io.*;

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

        if(s.indexOf(p) != -1){
        System.out.println("Yes");
        }      
        else{
        System.out.println("No");
        }
    }
}