import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.next(); s1 sc.next() sc.next sc String s2 = sc.next(); s2 sc.next() sc.next sc for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        } int i = 0; int i = 0; i 0 i < s1.length() i s1.length() s1.length s1 i++ i++ i {
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        } {
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        } if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            } s1.equals(s2) s1.equals s1 s2 {
            	System.out.println("Yes");
            	return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1) s1 s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1) s1.charAt(s1.length() - 1) s1.charAt s1 s1.length() - 1 s1.length() s1.length s1 1 s1.substring(0, s1.length() - 1) s1.substring s1 0 s1.length() - 1 s1.length() s1.length s1 1 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    }
} Main
import java.util.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.next();
        String s2 = sc.next();
        for(int i = 0; i < s1.length(); i++){
        	if(s1.equals(s2)){
            	System.out.println("Yes");
            	return;
            }
            s1 = s1.charAt(s1.length() - 1) + s1.substring(0, s1.length() - 1);
        }
        System.out.println("No");
    }
}