import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	}
} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	} main {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan scan.close() scan.close scan int len = S.length(); len S.length() S.length S char ch = T.charAt(0); ch T.charAt(0) T.charAt T 0 for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		} int i = 0 ; int i = 0 ; i 0 i < len i len i++ i++ i {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		} {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		} if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			} ch == S.charAt(i) ch S.charAt(i) S.charAt S i {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			} String f = S.substring(i); f S.substring(i) S.substring S i String b = S.substring(0, i); b S.substring(0, i) S.substring S 0 i if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				} T.equals(f + b) T.equals T f + b f b {
					System.out.print("Yes");
					return;
				} System.out.print("Yes") System.out.print System.out System System.out "Yes" return; System.out.print("No") System.out.print System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		scan.close();
		
		int len = S.length();
		char ch = T.charAt(0);
		
		for (int i = 0 ; i < len ; i++) {
			if (ch == S.charAt(i)) {
				String f = S.substring(i);
				String b = S.substring(0, i);
				if (T.equals(f + b)) {
					System.out.print("Yes");
					return;
				}
			}
		}
		
		System.out.print("No"); 
	}
}
