import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	}
	
	public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	}
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	}
	
	public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc char[] ac = a.toCharArray(); ac a.toCharArray() a.toCharArray a char[] bc = b.toCharArray(); bc b.toCharArray() b.toCharArray b int time = ac.length; time ac.length ac ac.length while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		} time != 0 time 0 {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		} if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			} Arrays.equals(ac, bc) Arrays.equals Arrays ac bc {
				break;
			} break; {
				time--;
				rotate(ac);
			} time-- time rotate(ac) rotate ac if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		} time == 0 time 0 {
			System.out.printf("No");
		} System.out.printf("No") System.out.printf System.out System System.out "No" {
			System.out.printf("Yes");
		} System.out.printf("Yes") System.out.printf System.out System System.out "Yes" sc.close() sc.close sc String[] args args public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	} rotate {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	} char t = c[c.length-1]; t c[c.length-1] c c.length-1 c.length c c.length 1 for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		} int i = c.length-2; int i = c.length-2; i c.length-2 c.length c c.length 2 i >= 0 i 0 i-- i-- i {
			c[i+1] = c[i];
		} {
			c[i+1] = c[i];
		} c[i+1] = c[i] c[i+1] c i+1 i 1 c[i] c i c[0] = t c[0] c 0 t char[] c c public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	}
	
	public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	}
} public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	}
	
	public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	}
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		char[] ac = a.toCharArray();
		char[] bc = b.toCharArray();
		int time = ac.length;
		while(time != 0) {
			
			if(Arrays.equals(ac, bc)) {
				break;
			}else {
				time--;
				rotate(ac);
			}
		}
		
		if(time == 0) {
			System.out.printf("No");
		}else {
			System.out.printf("Yes");
		}
		
		sc.close();
	}
	
	public static void rotate(char[] c) {
		char t = c[c.length-1];
		for(int i = c.length-2; i >= 0; i--) {
			c[i+1] = c[i];
		}
		c[0] = t;
	}
}