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();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} 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();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	} 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 String result = "No"; result "No" for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		} {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		} S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1) S S.substring(S.length() - 1) + S.substring(0, S.length() - 1) S.substring(S.length() - 1) S.substring S S.length() - 1 S.length() S.length S 1 S.substring(0, S.length() - 1) S.substring S 0 S.length() - 1 S.length() S.length S 1 if (T.equals(S)) {
				result = "Yes";
				break;
			} T.equals(S) T.equals T S {
				result = "Yes";
				break;
			} result = "Yes" result "Yes" break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} 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();
		String result = "No";

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(S.length() - 1) + S.substring(0, S.length() - 1);
			if (T.equals(S)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
}
