import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		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 str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str1 = sc.nextLine(); str1 sc.nextLine() sc.nextLine sc String str2 = sc.nextLine(); str2 sc.nextLine() sc.nextLine sc String ans = "No"; ans "No" for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		} int i = 0; int i = 0; i 0 i < str1.length() i str1.length() str1.length str1 i++ i++ i {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		} {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		} if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			} str1.equals(str2) str1.equals str1 str2 {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			} char c[] = new char[str1.length()]; c new char[str1.length()] str1.length() str1.length str1 char temp = ' '; temp ' ' for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				} int j = 0; int j = 0; j 0 j < str1.length() j str1.length() str1.length str1 j++ j++ j {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				} {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				} if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					} j == 0 j 0 {
						temp = str1.charAt(j);
					} temp = str1.charAt(j) temp str1.charAt(j) str1.charAt str1 j {
						c[j - 1] = str1.charAt(j);
					} c[j - 1] = str1.charAt(j) c[j - 1] c j - 1 j 1 str1.charAt(j) str1.charAt str1 j c[str1.length() - 1] = temp c[str1.length() - 1] c str1.length() - 1 str1.length() str1.length str1 1 temp str1 = String.valueOf(c) str1 String.valueOf(c) String.valueOf String c 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 str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.nextLine();
		String str2 = sc.nextLine();
		String ans = "No";
		for(int i = 0; i < str1.length(); i++) {
			if(str1.equals(str2)) {
				ans = "Yes";
				break;
			} else {
				char c[] = new char[str1.length()];
				char temp = ' ';
				for(int j = 0; j < str1.length(); j++) {
					if(j == 0) {
						temp = str1.charAt(j);
					}else {
						c[j - 1] = str1.charAt(j);
					}
				}
				c[str1.length() - 1] = temp;
				
				str1 = String.valueOf(c);
			}
		}
		System.out.println(ans);
	}
}