import java.util.Scanner;

public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
} Main public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	} main {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	} Scanner scan = new Scanner (System.in); scan new Scanner (System.in) String str str search_str; search_str StringBuilder prostr; prostr int result; result str = scan.nextLine() str scan.nextLine() scan.nextLine scan search_str = scan.nextLine() search_str scan.nextLine() scan.nextLine scan prostr = new StringBuilder(str) prostr new StringBuilder(str) prostr = prostr.append(str.substring(0, search_str.length())) prostr prostr.append(str.substring(0, search_str.length())) prostr.append prostr str.substring(0, search_str.length()) str.substring str 0 search_str.length() search_str.length search_str result = prostr.indexOf(search_str) result prostr.indexOf(search_str) prostr.indexOf prostr search_str if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} result != -1 result -1 1 {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" scan.close() scan.close scan String [] args args public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
} public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main (String [] args) {
		Scanner scan = new Scanner (System.in);
		String str, search_str;
		StringBuilder prostr;
		int result;
		
		str = scan.nextLine();
		search_str = scan.nextLine();
		
		prostr = new StringBuilder(str);
		prostr = prostr.append(str.substring(0, search_str.length()));
		
		result = prostr.indexOf(search_str);
		
		if ( result != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
				
		scan.close();
	}
}

