
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }

}
 import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }

} Main public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    } main {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    } Scanner scanner=new Scanner(System.in); scanner new Scanner(System.in) String s=scanner.next(); s scanner.next() scanner.next scanner String p=scanner.next(); p scanner.next() scanner.next scanner s=s+s s s+s s s int index=s.indexOf(p); index s.indexOf(p) s.indexOf s p if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        } index==-1 index -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) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }

} public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }

} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner=new Scanner(System.in);
        String s=scanner.next();
        String p=scanner.next();
        s=s+s;
        int index=s.indexOf(p);
        if(index==-1){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }

}

