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 res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	}
} 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 res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s  = sc.next();
		String t  = sc.next();
		String res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	} main {
		Scanner sc = new Scanner(System.in);
		String s  = sc.next();
		String t  = sc.next();
		String res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	} 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 res = "No"; res "No" String s2 = s; s2 s while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		} true {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		} s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1) s2 s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1) s2.substring(s2.length()-1, s2.length()) s2.substring s2 s2.length()-1 s2.length() s2.length s2 1 s2.length() s2.length s2 s2.substring(0, s2.length()-1) s2.substring s2 0 s2.length()-1 s2.length() s2.length s2 1 if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			} t.equals(s2) t.equals t s2 {
				res = "Yes";
				break;
			} res = "Yes" res "Yes" break; if (s.equals(s2)) {
				break;
			} s.equals(s2) s.equals s s2 {
				break;
			} 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 sc = new Scanner(System.in);
		String s  = sc.next();
		String t  = sc.next();
		String res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s  = sc.next();
		String t  = sc.next();
		String res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	}
} 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 res = "No";
		String s2 = s;
		while (true) {
			s2 = s2.substring(s2.length()-1, s2.length()) + s2.substring(0, s2.length()-1);
			if (t.equals(s2)) {
				res = "Yes";
				break;
			}else if (s.equals(s2)) {
				break;
			}
		}
		System.out.println(res);
	}
}
