import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} main {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String correct = scanner.next(); correct scanner.next() scanner.next scanner String target = scanner.next(); target scanner.next() scanner.next scanner char[] targ = target.toCharArray(); targ target.toCharArray() target.toCharArray target for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < correct.length() i correct.length() correct.length correct i++ i++ i {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		} {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		} char[] converted = new char[correct.length()]; converted new char[correct.length()] correct.length() correct.length correct for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			} int j = 0; int j = 0; j 0 j < correct.length() j correct.length() correct.length correct j++ j++ j {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			} {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			} int a = i + j; a i + j i j if (a >= correct.length()) {
					a = a - correct.length();
				} a >= correct.length() a correct.length() correct.length correct {
					a = a - correct.length();
				} a = a - correct.length() a a - correct.length() a correct.length() correct.length correct converted[j] = targ[a] converted[j] converted j targ[a] targ a if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			} correct.equals(String.valueOf(converted)) correct.equals correct String.valueOf(converted) String.valueOf String converted {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String correct = scanner.next();
		String target = scanner.next();

		char[] targ = target.toCharArray();
		for (int i = 0; i < correct.length(); i++) {
			char[] converted = new char[correct.length()];
			for (int j = 0; j < correct.length(); j++) {
				int a = i + j;
				if (a >= correct.length()) {
					a = a - correct.length();
				}
				converted[j] = targ[a];
			}
			if (correct.equals(String.valueOf(converted))) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

}
