import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	}
} Main public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	} main {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc int count = 0; count 0 for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		} int i = 0; int i = 0; i 0 i < line.length() i line.length() line.length line i++ i++ i {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		} {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		} StringBuilder r = new StringBuilder(); r new StringBuilder() r.append(line.substring(line.length() - 1, line.length())) r.append r line.substring(line.length() - 1, line.length()) line.substring line line.length() - 1 line.length() line.length line 1 line.length() line.length line r.append(line.substring(0, line.length() - 1)) r.append r line.substring(0, line.length() - 1) line.substring line 0 line.length() - 1 line.length() line.length line 1 line = r.toString() line r.toString() r.toString r if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			} line.contains(line2) line.contains line line2 {
				System.out.println("Yes");
				count++;
				break;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" count++ count break; if (count == 0) {
			System.out.println("No");
		} count == 0 count 0 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] arges arges public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	}
} public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] arges) {

		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
		String line2 = sc.nextLine();

		int count = 0;

		for (int i = 0; i < line.length(); i++) {
			StringBuilder r = new StringBuilder();
			r.append(line.substring(line.length() - 1, line.length()));
			r.append(line.substring(0, line.length() - 1));
			line = r.toString();
			if (line.contains(line2)) {
				System.out.println("Yes");
				count++;
				break;
			}
		}
		if (count == 0) {
			System.out.println("No");
		}

	}
}