import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	} main {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	} try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		} {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc String search = s; search s for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					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 {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			} {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			} search = s.substring(i) + s.substring(0, i) search s.substring(i) + s.substring(0, i) s.substring(i) s.substring s i s.substring(0, i) s.substring s 0 i if(search.contains(p)) {
					System.out.println("Yes");
					return;
				} search.contains(p) search.contains search p {
					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" String[] args args public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
}
