import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	}
} Main @SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	} main {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s=scanner.next(); s scanner.next() scanner.next scanner String t=scanner.next(); t scanner.next() scanner.next scanner String tmp=s; tmp s for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		} {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		} if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			} tmp.equals(t) tmp.equals tmp t {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1) tmp tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1) tmp.substring(s.length()-1) tmp.substring tmp s.length()-1 s.length() s.length s 1 tmp.substring(0, s.length()-1) tmp.substring tmp 0 s.length()-1 s.length() s.length s 1 System.out.println("No") System.out.println System.out System System.out "No" String args[] args public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	}
} public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s=scanner.next();
		String t=scanner.next();
		
		String tmp=s;
		for(int i=0;i<s.length();i++) {
			if(tmp.equals(t)) {
				System.out.println("Yes");
				return;
			}
			tmp=tmp.substring(s.length()-1)+tmp.substring(0, s.length()-1);
		}
		System.out.println("No");
	}
}
