import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String a = sc.next(); a sc.next() sc.next sc boolean f = false; f false System.out.println( f ? "Yes":"No") System.out.println System.out System System.out f ? "Yes":"No" f "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next(); 
        String a = sc.next();
        
        boolean f = false;
      in :  for(int i=0;i<s.length();i++){
            for(int j=0;j<a.length();j++){
                if(s.charAt((i+j)%s.length()) != a.charAt(j))continue in;
            }
            f=true;break;
        }
        
        System.out.println( f ? "Yes":"No");
    }
}

