import java.util.*;
public class Main {
	public static void main(String[] args){
		stringRotation();
	}
	
	public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		stringRotation();
	}
	
	public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args){
		stringRotation();
	} main {
		stringRotation();
	} stringRotation() stringRotation String[] args args public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	} stringRotation {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		} {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		} int j=0; j 0 int k=i; k i while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			} s.charAt(k) == t.charAt(j) s.charAt(k) s.charAt s k t.charAt(j) t.charAt t j {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			} k++ k j++ j if (k == s.length()) k=0; k == s.length() k s.length() s.length s k=0 k 0 if (j == t.length()) {
					System.out.println("Yes");
					return;
				} j == t.length() j t.length() t.length t {
					System.out.println("Yes");
					return;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" public class Main {
	public static void main(String[] args){
		stringRotation();
	}
	
	public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} public class Main {
	public static void main(String[] args){
		stringRotation();
	}
	
	public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		stringRotation();
	}
	
	public static void stringRotation() {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		for (int i=0; i<s.length(); i++) {
			int j=0;
			int k=i;
			while (s.charAt(k) == t.charAt(j)) {
				k++;
				j++;
				if (k == s.length()) k=0;
				if (j == t.length()) {
					System.out.println("Yes");
					return;
				}
			}
		}
		System.out.println("No");
	}
}