import java.util.*;
import java.io.*;

public class Main{

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main{

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    }
} Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    } main {
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String s1 = in.next(); s1 in.next() in.next in String s2 = in.next(); s2 in.next() in.next in boolean check = false; check false int n = s1.length(); n s1.length() s1.length s1 for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        } int i =0 ; int i =0 ; i 0 i< n i n i++ i++ i {
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        } {
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        } if(s1.equals(s2)){
                check = true;
                break;
            } s1.equals(s2) s1.equals s1 s2 {
                check = true;
                break;
            } check = true check true break; s1 = s1.charAt(n-1) + s1.substring(0 , n-1) s1 s1.charAt(n-1) + s1.substring(0 , n-1) s1.charAt(n-1) s1.charAt s1 n-1 n 1 s1.substring(0 , n-1) s1.substring s1 0 n-1 n 1 if(check)  System.out.println("Yes");
         else System.out.println("No"); check System.out.println("Yes") System.out.println System.out System System.out "Yes" 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){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    }
} public class Main{

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    }
} Main
import java.util.*;
import java.io.*;

public class Main{

    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
            String s1 = in.next();
            String s2 = in.next();
            boolean check = false;
            int n = s1.length();
        for(int i =0 ; i< n; i++){
            if(s1.equals(s2)){
                check = true;
                break;
            }
            s1 = s1.charAt(n-1) + s1.substring(0 , n-1);
            // System.out.println(s1);
        }

            
         if(check)  System.out.println("Yes");
         else System.out.println("No");
    }
}