import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	}
	static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	}
	static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		} int i=0; int i=0; i 0 i<=S.length() i S.length() S.length S i++ i++ i {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		} {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		} if(T.equals(S)) {
				System.out.println("Yes");
				return;
			} T.equals(S) T.equals T S {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; S = rotate(S) S rotate(S) rotate S System.out.println("No") System.out.println System.out System System.out "No" String[] args args static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	} rotate {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	} StringBuilder ans = new StringBuilder(str); ans new StringBuilder(str) ans.insert(0,ans.charAt(ans.length()-1)) ans.insert ans 0 ans.charAt(ans.length()-1) ans.charAt ans ans.length()-1 ans.length() ans.length ans 1 ans.deleteCharAt(ans.length()-1) ans.deleteCharAt ans ans.length()-1 ans.length() ans.length ans 1 return ans.toString(); ans.toString() ans.toString ans String str str public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	}
	static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	}
	static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		for(int i=0;i<=S.length();i++) {
			if(T.equals(S)) {
				System.out.println("Yes");
				return;
			}
			S = rotate(S);
		}
		System.out.println("No");
	}
	static String rotate(String str) {
		StringBuilder ans = new StringBuilder(str);
		ans.insert(0,ans.charAt(ans.length()-1));
		ans.deleteCharAt(ans.length()-1);
		return ans.toString();
	}
}
