public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} Main public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} java.util.Scanner scan = new java.util.Scanner(System.in); scan new java.util.Scanner(System.in) String str1 = scan.nextLine(); str1 scan.nextLine() scan.nextLine scan String str2 = scan.nextLine(); str2 scan.nextLine() scan.nextLine scan str1 = str1 +str1 str1 str1 +str1 str1 str1 if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} str1.indexOf(str2) != -1 str1.indexOf(str2) str1.indexOf str1 str2 -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" String[] args args public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

} Main
public class Main {
	public static void main(String[] args){
		java.util.Scanner scan = new java.util.Scanner(System.in);
		String str1 = scan.nextLine();
		String str2 = scan.nextLine();

		str1 = str1 +str1;
		if(str1.indexOf(str2) != -1){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}

}