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();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("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();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		}
	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		scan.close();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		scan.close();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("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 char sc[]=s.toCharArray(); sc s.toCharArray() s.toCharArray s char tc[]=t.toCharArray(); tc t.toCharArray() t.toCharArray t for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		} {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		} int cnt=0; cnt 0 for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			} int j=i; int j=i; j i j<s.length()+i j s.length()+i s.length() s.length s i j++ j++ j {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			} {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			} if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break; tc[cnt]==sc[j%s.length()] tc[cnt] tc cnt sc[j%s.length()] sc j%s.length() j s.length() s.length s {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				} cnt++ cnt if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					} cnt==s.length() cnt s.length() s.length s {
						System.out.println("Yes");
						break;
					} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; break; if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No"); cnt==s.length() cnt s.length() s.length s {
				break;
			} break; if(i==s.length()-1)System.out.println("No"); i==s.length()-1 i 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 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		scan.close();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("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();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("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();
		char sc[]=s.toCharArray();
		char tc[]=t.toCharArray();
		for(int i=0;i<s.length();i++) {
			int cnt=0;
			for(int j=i;j<s.length()+i;j++) {
				if(tc[cnt]==sc[j%s.length()]) {
					cnt++;
					if(cnt==s.length()) {
						System.out.println("Yes");
						break;
					}
				}else break;
			}
			if(cnt==s.length()) {
				break;
			}else if(i==s.length()-1)System.out.println("No");
		}
	}

}
