import java.io.IOException;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {
		
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		String str = s + s;
		String ans = scanner.nextLine();
		
		if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util class Main {
	public static void main(String[] args) throws IOException {
		
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		String str = s + s;
		String ans = scanner.nextLine();
		
		if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) throws IOException {
		
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		String str = s + s;
		String ans = scanner.nextLine();
		
		if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		String str = s + s;
		String ans = scanner.nextLine();
		
		if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String str = s + s; str s + s s s String ans = scanner.nextLine(); ans scanner.nextLine() scanner.nextLine scanner if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} str.contains(ans) str.contains str ans {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.IOException;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {
		
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		String str = s + s;
		String ans = scanner.nextLine();
		
		if(str.contains(ans)){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}