import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	} main {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		} int i=0; int i=0; i 0 i<a.length() i a.length() a.length a i++ i++ i {
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		} {
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		} if (b.equals(a)){
				System.out.println("Yes");
				return;
			} b.equals(a) b.equals b a {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1)) a (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1)) (a.substring(a.length()-1)).concat (a.substring(a.length()-1)) a.substring a a.length()-1 a.length() a.length a 1 a.substring(0, a.length()-1) a.substring a 0 a.length()-1 a.length() a.length a 1 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) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		String a = sc.next();
		String b = sc.next();
		
		for(int i=0; i<a.length(); i++){
			
			if (b.equals(a)){
				System.out.println("Yes");
				return;
			}
//			System.out.println(a.substring(a.length()-1));
//			System.out.println(a.substring(0, a.length()-1));
			a = (a.substring(a.length()-1)).concat(a.substring(0, a.length()-1));
//			System.out.println("--");
//			System.out.println(a);
		}
		
		
		
		
		System.out.println("No");
		
	}

}
