import java.util.Scanner;
 
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	}	
}	 import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	}	
} Main public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s1 = sc.nextLine(); s1 sc.nextLine() sc.nextLine sc String s2 = sc.nextLine(); s2 sc.nextLine() sc.nextLine sc String s3; s3 int n = s1.length(); n s1.length() s1.length s1 int ans = 0; ans 0 while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		} n !=0 n 0 {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		} s3  = switchs(s1,n) s3 switchs(s1,n) switchs s1 n if(s3.equals(s2)) {
				ans = 1;
				break;
			} s3.equals(s2) s3.equals s3 s2 {
				ans = 1;
				break;
			} ans = 1 ans 1 break; n-- n if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} ans==1 ans 1 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String args[] args private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	} switchs {
		return s1.substring(n)+s1.substring(0, n);
	} return s1.substring(n)+s1.substring(0, n); s1.substring(n)+s1.substring(0, n) s1.substring(n) s1.substring s1 n s1.substring(0, n) s1.substring s1 0 n String s1 s1 int n n public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	}	
} public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	}	
} Main
import java.util.Scanner;
 
public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s2 = sc.nextLine();
		String s3;
		int n = s1.length();
		int ans = 0;
		while(n !=0) {
			s3  = switchs(s1,n);
//			System.out.println(s3);
			if(s3.equals(s2)) {
				ans = 1;
				break;
			}
			n--;
		}
		if(ans==1) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
	private static String switchs(String s1, int n) {
		return s1.substring(n)+s1.substring(0, n);
	}	
}	