import java.util.Scanner;

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

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