import java.io.*;

public class Main{

    public static void main(String[]args)throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }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 strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[]args)throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String strS = br.readLine(); strS br.readLine() br.readLine br String strP = br.readLine(); strP br.readLine() br.readLine br strS = strS + strS strS strS + strS strS strS if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } strS.indexOf(strP) != -1 strS.indexOf(strP) strS.indexOf strS strP -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)throws IOException{

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }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 strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }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 strS = br.readLine();
        String strP = br.readLine();

        strS = strS + strS;
        if(strS.indexOf(strP) != -1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}