import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} 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 S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String S = s + s; S s + s s s String P = sc.next(); P sc.next() sc.next sc boolean flag = false; flag false for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i <= S.length() - P.length() i S.length() - P.length() S.length() S.length S P.length() P.length P i++ i++ i {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		} {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		} if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			} S.substring(i, i + P.length()).equals(P) S.substring(i, i + P.length()).equals S.substring(i, i + P.length()) S.substring S i i + P.length() i P.length() P.length P P {
				flag = true;
				break;
			} flag = true flag true break; 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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} 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 S = s + s;
		String P = sc.next();

		boolean flag = false;
		for(int i = 0; i <= S.length() - P.length(); i++) {
			if(S.substring(i, i + P.length()).equals(P)){
				flag = true;
				break;
			}
		}

		if(flag) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
}
