
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String T = scan.nextLine();
		String ans = "No";

		for (int i = 0; i < S.length(); i++){
			S = S.substring(S.length() - 1) + S.substring(0,S.length() - 1);
			if (S.equals(T)){
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String T = scan.nextLine();
		String ans = "No";

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

		for (int i = 0; i < S.length(); i++){
			S = S.substring(S.length() - 1) + S.substring(0,S.length() - 1);
			if (S.equals(T)){
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String T = scan.nextLine();
		String ans = "No";

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

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

		for (int i = 0; i < S.length(); i++){
			S = S.substring(S.length() - 1) + S.substring(0,S.length() - 1);
			if (S.equals(T)){
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} Main

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String S = scan.nextLine();
		String T = scan.nextLine();
		String ans = "No";

		for (int i = 0; i < S.length(); i++){
			S = S.substring(S.length() - 1) + S.substring(0,S.length() - 1);
			if (S.equals(T)){
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
}