import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	}

	private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	}
} 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.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	}

	private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	} main {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc boolean flg = false; flg false for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		} {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		} if (S.equals(T)) {
				flg = true;
				break;
			} S.equals(T) S.equals S T {
				flg = true;
				break;
			} flg = true flg true break; S = change(S) S change(S) change S System.out.println(flg ? "Yes" : "No") System.out.println System.out System System.out flg ? "Yes" : "No" flg "Yes" "No" String[] args args private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	} change {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	} str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1) str String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1) String.valueOf(str.charAt(str.length() - 1)) String.valueOf String str.charAt(str.length() - 1) str.charAt str str.length() - 1 str.length() str.length str 1 str.substring(0, str.length() - 1) str.substring str 0 str.length() - 1 str.length() str.length str 1 return str; str String str str public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	}

	private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	}

	private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		String S = sc.next();
		String T = sc.next();

		boolean flg = false;

		for (int i = 0; i < S.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}
			S = change(S);
		}

		System.out.println(flg ? "Yes" : "No");

	}

	private static String change(String str) {

		str = String.valueOf(str.charAt(str.length() - 1)) + str.substring(0, str.length() - 1);
		return str;
	}
}