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