import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	} main {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String text; text text = scan.next() text scan.next() scan.next scan char[] s = text.toCharArray(); s text.toCharArray() text.toCharArray text text = scan.next() text scan.next() scan.next scan char[] p = text.toCharArray(); p text.toCharArray() text.toCharArray text func(s , p ,0) func s p 0 String[] args args static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	} func {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	} for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		} int i = 0 ; int i = 0 ; i 0 i < s.length i s.length s s.length i++ i++ i {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		} {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		} if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			} n == s.length n s.length s s.length {
				System.out.println("No");
				break;
			} System.out.println("No") System.out.println System.out System System.out "No" break; if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			} s[i+n >= s.length ? i+n-s.length : i+n] != p[i] s[i+n >= s.length ? i+n-s.length : i+n] s i+n >= s.length ? i+n-s.length : i+n i+n >= s.length i+n i n s.length s s.length i+n-s.length i+n i n s.length s s.length i+n i n p[i] p i {
				n++;
				func(s , p , n );
				break;
			} n++ n func(s , p , n ) func s p n break; if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			} i == p.length - 1 i p.length - 1 p.length p p.length 1 {
				System.out.println("Yes");
				break;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; char[] s s char[] p p int n n public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
}