import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	} main {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) boolean b=false; b false String str1=sc.next(); str1 sc.next() sc.next sc String str2=sc.next(); str2 sc.next() sc.next sc String str3=str1+str1; str3 str1+str1 str1 str1 char [] ch2=str2.toCharArray(); ch2 str2.toCharArray() str2.toCharArray str2 char [] ch3=str3.toCharArray(); ch3 str3.toCharArray() str3.toCharArray str3 for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		} int i=0; int i=0; i 0 i<str1.length() i str1.length() str1.length str1 i++ i++ i {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		} {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		} for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			} int j=0; int j=0; j 0 j<str2.length() j str2.length() str2.length str2 j++ j++ j {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			} {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			} if(ch2[j]!=ch3[i+j])break; ch2[j]!=ch3[i+j] ch2[j] ch2 j ch3[i+j] ch3 i+j i j break; if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				} j+1==str2.length()&&ch2[j]==ch3[i+j] j+1==str2.length() j+1 j 1 str2.length() str2.length str2 ch2[j]==ch3[i+j] ch2[j] ch2 j ch3[i+j] ch3 i+j i j {
					b=true;
				} b=true b true if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} b==true b true {
			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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean b=false;
		String str1=sc.next();
		String str2=sc.next();
		String str3=str1+str1;
		char [] ch2=str2.toCharArray();
		char [] ch3=str3.toCharArray();
		for(int i=0;i<str1.length();i++) {
			for(int j=0;j<str2.length();j++) {
				if(ch2[j]!=ch3[i+j])break;
				if(j+1==str2.length()&&ch2[j]==ch3[i+j]) {
					b=true;
				}
			}
		}
		if(b==true) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}
