import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			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 S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String S = scanner.nextLine(); S scanner.nextLine() scanner.nextLine scanner String T = scanner.nextLine(); T scanner.nextLine() scanner.nextLine scanner scanner.close() scanner.close scanner boolean flag = false; flag false for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		} int n = 0; int n = 0; n 0 n < S.length() n S.length() S.length S n++ n++ n {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		} {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		} if (S.equals(T)) {
				flag = true;
				break;
			} S.equals(T) S.equals S T {
				flag = true;
				break;
			} flag = true flag true break; String s = S.substring(S.length() - 1, S.length()); s S.substring(S.length() - 1, S.length()) S.substring S S.length() - 1 S.length() S.length S 1 S.length() S.length S S = S.substring(0, S.length() - 1) S S.substring(0, S.length() - 1) S.substring S 0 S.length() - 1 S.length() S.length S 1 S = s + S S s + S s S if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} flag {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			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 scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			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 S = scanner.nextLine();
		String T = scanner.nextLine();
		scanner.close();

		boolean flag = false;

		for (int n = 0; n < S.length(); n++) {
			if (S.equals(T)) {
				flag = true;
				break;
			}

			String s = S.substring(S.length() - 1, S.length());
			S = S.substring(0, S.length() - 1);
			S = s + S;
		}
		if (flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}