import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
} Main static final Scanner s=new Scanner(System.in); s new Scanner(System.in) public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	} main {
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	} String a=s.next() a s.next() s.next s b=s.next(); b s.next() s.next s System.out.println("No") System.out.println System.out System System.out "No" String args[] args public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
} public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main{

	static final Scanner s=new Scanner(System.in);

	public static void main(String args[]){
		String a=s.next(),b=s.next();
		outer:
		for(int i=0;i<a.length();i++) {
			for(int j=0;j<b.length();j++) {
				if(a.charAt((i+j)%a.length())!=b.charAt(j))
					continue outer;
				//System.err.printf("%d %d\n",i,j);
			}
			System.out.println("Yes");
			return;
		}
		System.out.println("No");
	}
}