
import java.util.*;
import java.util.regex.Pattern;

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

import java.util.*;
import java.util.regex.Pattern;

public class Main {
	 
	public static void main(String[] args) {
		Scanner cin=new Scanner(System.in);
		
		String str=cin.nextLine();
		str=str+str;
		String jstr=cin.nextLine();
		
		if(str.indexOf(jstr)!=-1)System.out.println("Yes");
		else System.out.println("No");
	}
	
}
