
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				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) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} main {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str1 = scan.nextLine(); str1 scan.nextLine() scan.nextLine scan String str2 = scan.nextLine(); str2 scan.nextLine() scan.nextLine scan if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		} str1.equals(str2) str1.equals str1 str2 {
			System.out.println("Yes");
			return;
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; String[] str_arr = new String[str1.length() - 1]; str_arr new String[str1.length() - 1] str1.length() - 1 str1.length() str1.length str1 1 for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		} int i = 0; int i = 0; i 0 i < str1.length() - 1 i str1.length() - 1 str1.length() str1.length str1 1 i++ i++ i {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		} {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		} str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1) str_arr[i] str_arr i str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1) str1.substring(i + 1, str1.length()) str1.substring str1 i + 1 i 1 str1.length() str1.length str1 str1.substring(0, i + 1) str1.substring str1 0 i + 1 i 1 for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < str_arr.length i str_arr.length str_arr str_arr.length i++ i++ i {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		} {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		} if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			} str_arr[i].equals(str2) str_arr[i].equals str_arr[i] str_arr i str2 {
				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) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

} Main

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();
		if (str1.equals(str2)) {
			System.out.println("Yes");
			return;
		}
		String[] str_arr = new String[str1.length() - 1];
		for (int i = 0; i < str1.length() - 1; i++) {
			str_arr[i] = str1.substring(i + 1, str1.length()) + str1.substring(0, i + 1);
		}
		for (int i = 0; i < str_arr.length; i++) {
			if(str_arr[i].equals(str2)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}

}
