import java.util.*;

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

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