import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	}
} Main public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	} main {
		new Main().solve(new Scanner(System.in));
	} new Main().solve(new Scanner(System.in)) new Main().solve new Main() new Scanner(System.in) String[] args args public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	} solve {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	} String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		} {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		} StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(s.charAt(s.length()-1)) sb.append sb s.charAt(s.length()-1) s.charAt s s.length()-1 s.length() s.length s 1 sb.append(s.substring(0, s.length()-1)) sb.append sb s.substring(0, s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			} sb.toString().equals(t) sb.toString().equals sb.toString() sb.toString sb t {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; s = sb.toString() s sb.toString() sb.toString sb System.out.println("No") System.out.println System.out System System.out "No" Scanner sc sc public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().solve(new Scanner(System.in));
	}

	public void solve(Scanner sc) {
		String s = sc.next();
		String t = sc.next();
		
		for(int i=0; i<s.length(); i++) {
			StringBuilder sb = new StringBuilder();
			sb.append(s.charAt(s.length()-1));
			sb.append(s.substring(0, s.length()-1));
			
			if(sb.toString().equals(t)) {
				System.out.println("Yes");
				return;
			}
			s = sb.toString();
		}
		
		System.out.println("No");
	}
}