import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author must
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
    
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
    
} Main /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc ArrayList<String> ary = new ArrayList<>(); ary new ArrayList<>() String tmp = s; tmp s for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        } {
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        } String a = tmp.substring(0, s.length()-1); a tmp.substring(0, s.length()-1) tmp.substring tmp 0 s.length()-1 s.length() s.length s 1 a = tmp.substring(s.length()-1) + a a tmp.substring(s.length()-1) + a tmp.substring(s.length()-1) tmp.substring tmp s.length()-1 s.length() s.length s 1 a ary.add(a) ary.add ary a tmp = a tmp a for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        } String ss ary {
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        } {
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        } if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            } ss.equals(t)==true ss.equals(t) ss.equals ss t true {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
    
} public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
    
} Main
import java.util.ArrayList;
import java.util.Scanner;

/**
 *
 * @author must
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        
        String s = sc.next();
        String t = sc.next();
        
        ArrayList<String> ary = new ArrayList<>();
        String tmp = s;
        //ary.add(tmp);
        for(int i=0;i<s.length();i++){
            String a = tmp.substring(0, s.length()-1);
            a = tmp.substring(s.length()-1) + a;
            //System.out.println(a);
            ary.add(a);
            tmp = a;
        }
        
        for(String ss : ary){
            if (ss.equals(t)==true){
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
    
}
