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