import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		} {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) char[] s = scanner.next().toCharArray(); s scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner char[] t = scanner.next().toCharArray(); t scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner boolean result = false; result false for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			} {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			} int count = 0; count 0 while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				} (count < s.length) && (s[(i + count) % s.length] == t[count]) (count < s.length) count s.length s s.length (s[(i + count) % s.length] == t[count]) s[(i + count) % s.length] s (i + count) % s.length (i + count) i count s.length s s.length t[count] t count {
					count++;
				} count++ count if (s.length == count) {
					result = true;
					break;
				} s.length == count s.length s s.length count {
					result = true;
					break;
				} result = true result true break; System.out.println(result ? "Yes" : "No") System.out.println System.out System System.out result ? "Yes" : "No" result "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			char[] s = scanner.next().toCharArray();
			char[] t = scanner.next().toCharArray();
			boolean result = false;
			for (int i = 0; i < s.length; i++) {
				int count = 0;
				while ((count < s.length) && (s[(i + count) % s.length] == t[count])) {
					count++;
				}
				if (s.length == count) {
					result = true;
					break;
				}
			}
			System.out.println(result ? "Yes" : "No");
		}
	}
}
