import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	} main {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String in1 = scanner.nextLine(); in1 scanner.nextLine() scanner.nextLine scanner String in2 = scanner.nextLine(); in2 scanner.nextLine() scanner.nextLine scanner String res = "No"; res "No" for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < in1.length() i in1.length() in1.length in1 i++ i++ i {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		} {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		} if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			} in2.equals(in1.substring(i) + in1.substring(0, i )) in2.equals in2 in1.substring(i) + in1.substring(0, i ) in1.substring(i) in1.substring in1 i in1.substring(0, i ) in1.substring in1 0 i {
				res = "Yes";
				break;
			} res = "Yes" res "Yes" break; System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String in1 = scanner.nextLine();
		String in2 = scanner.nextLine();
		String res = "No";
		for(int i = 0; i < in1.length(); i++) {
			if(in2.equals(in1.substring(i) + in1.substring(0, i ))){
				res = "Yes";
				break;
			}
		}
		System.out.println(res);
	}

}