import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	} run {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String p = scan.next(); p scan.next() scan.next scan s = s + s s s + s s s char[] sc = s.toCharArray(); sc s.toCharArray() s.toCharArray s char[] ps = p.toCharArray(); ps p.toCharArray() p.toCharArray p boolean flag = false; flag false for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		} int i = 0; int i = 0; i 0 i < sc.length - ps.length i sc.length - ps.length sc.length sc sc.length ps.length ps ps.length i++ i++ i {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		} {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		} if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			} sc[i] == ps[0] sc[i] sc i ps[0] ps 0 {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			} for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				} int j = 0; int j = 0; j 0 j < ps.length j ps.length ps ps.length j++ j++ j {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				} {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				} if (sc[i + j] != ps[j]) break; sc[i + j] != ps[j] sc[i + j] sc i + j i j ps[j] ps j break; if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					} j == ps.length - 1 && sc[i + j] == ps[j] j == ps.length - 1 j ps.length - 1 ps.length ps ps.length 1 sc[i + j] == ps[j] sc[i + j] sc i + j i j ps[j] ps j {
						System.out.println("Yes");
						flag = true;
					} System.out.println("Yes") System.out.println System.out System System.out "Yes" flag = true flag true if (flag == true) break; flag == true flag true break; if (flag == false)
			System.out.println("No"); flag == false flag false System.out.println("No") System.out.println System.out System System.out "No" public static void main(String[] args) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] args args public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
} Main
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String p = scan.next();
		s = s + s;
		char[] sc = s.toCharArray();
		char[] ps = p.toCharArray();
		boolean flag = false;
		for (int i = 0; i < sc.length - ps.length; i++) {
			if (sc[i] == ps[0]) {
				for (int j = 0; j < ps.length; j++) {
					if (sc[i + j] != ps[j]) break;
					if (j == ps.length - 1 && sc[i + j] == ps[j]) {
						System.out.println("Yes");
						flag = true;
					}
				}
			}
			if (flag == true) break;
		}
		if (flag == false)
			System.out.println("No");
	}
	public static void main(String[] args) {
		new Main().run();
	}
}