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

public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
} import java.io.*; io.* java import java.util.*; util.* java public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
} Main public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } main {
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int len = S.length(); len S.length() S.length S boolean same = false; same false System.out.println(same?"Yes":"No") System.out.println System.out System System.out same?"Yes":"No" same "Yes" "No" String[] args args public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
} public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
} Main
import java.io.*;
import java.util.*;

public class Main{
  
 public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();
        String T = scanner.next();
        int len = S.length();
        boolean same = false;
        OUTER: for(int i = 0; i < len;i++){//roations
            same = true;
            for(int j = 0; j <len;j++){
                if(S.charAt((i+j)%len) != T.charAt(j)){
                    same = false; 
                    break;
                }

            }
            if(same)break;

        }


        System.out.println(same?"Yes":"No");
    } 
  
  
  
  
  
}