import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc String[] S = s.split(""); S s.split("") s.split s "" int slength = s.length(); slength s.length() s.length s int plength = p.length(); plength p.length() p.length p int same =0; same 0 for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i < slength i slength i++ i++ i {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		} {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		} if (same == 1) {
				break;
			} same == 1 same 1 {
				break;
			} break; StringBuilder smalls =new StringBuilder(); smalls new StringBuilder() int k = 0; k 0 int j = i; j i while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			} true {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			} smalls.append(S[j]) smalls.append smalls S[j] S j j++ j k++ k if (j >= slength) {
					j = 0;
				} j >= slength j slength {
					j = 0;
				} j = 0 j 0 if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				} k == plength k plength {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				} if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					} smalls.toString().equals(p) smalls.toString().equals smalls.toString() smalls.toString smalls p {
						System.out.println("Yes");
						same = 1;
					} System.out.println("Yes") System.out.println System.out System System.out "Yes" same = 1 same 1 break; if (same == 0) {
			System.out.println("No");
		} same == 0 same 0 {
			System.out.println("No");
		} 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) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String p = sc.nextLine();
		String[] S = s.split("");
		int slength = s.length();
		int plength = p.length();
		int same =0;
		for (int i = 0; i < slength; i++) {
			if (same == 1) {
				break;
			}
			StringBuilder smalls =new StringBuilder();
			int k = 0;
			int j = i;
			while (true) {
				smalls.append(S[j]);
				j++;
				k++;
				if (j >= slength) {
					j = 0;
				}
				if (k == plength) {
					if (smalls.toString().equals(p)) {
						System.out.println("Yes");
						same = 1;
					}
					break;
				}
			}
		}
		if (same == 0) {
			System.out.println("No");
		}
	}
}