import java.util.Scanner;

public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    }
}
       
	
	 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    }
} Main public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    } main {
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String str = in.nextLine(); str in.nextLine() in.nextLine in String str2 = in.nextLine(); str2 in.nextLine() in.nextLine in String str3 = str+str; str3 str+str str str boolean flag = false; flag false for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	} int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	} {
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	} if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    } str2.compareTo(str3.substring(i,i+str2.length()))==0 str2.compareTo(str3.substring(i,i+str2.length())) str2.compareTo str2 str3.substring(i,i+str2.length()) str3.substring str3 i i+str2.length() i str2.length() str2.length str2 0 {
		flag =true;
		break;
	    } flag =true flag true break; if(flag)System.out.println("Yes");
	else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    }
} public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);
	String str = in.nextLine();
	String str2 = in.nextLine();
	
	String str3 = str+str;
	boolean flag = false;
	for(int i=0;i<str.length();i++){
	    if(str2.compareTo(str3.substring(i,i+str2.length()))==0){
		flag =true;
		break;
	    }
	}
	if(flag)System.out.println("Yes");
	else System.out.println("No");
    }
}
       
	
	
