import java.util.Scanner;

public class Main {


		public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {


		public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int flg = 0; flg 0 String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan String s2 = s + s; s2 s + s s s int s2_len = s2.length(); s2_len s2.length() s2.length s2 int p_len = p.length(); p_len p.length() p.length p for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		} int s2_cnt = 0; int s2_cnt = 0; s2_cnt 0 s2_cnt < s2_len - p_len s2_cnt s2_len - p_len s2_len p_len s2_cnt++ s2_cnt++ s2_cnt {
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		} {
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		} int ans_cnt = 0; ans_cnt 0 for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			} int p_cnt = 0; int p_cnt = 0; p_cnt 0 p_cnt < p_len p_cnt p_len p_cnt++ p_cnt++ p_cnt {
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			} {
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			} if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				} p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt) p.charAt(p_cnt) p.charAt p p_cnt s2.charAt(s2_cnt + p_cnt) s2.charAt s2 s2_cnt + p_cnt s2_cnt p_cnt {
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				} ans_cnt++ ans_cnt if(ans_cnt == p_len){
						flg = 1;
					} ans_cnt == p_len ans_cnt p_len {
						flg = 1;
					} flg = 1 flg 1 if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No"); flg == 1 flg 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" scan.close() scan.close scan String[] args args public class Main {


		public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	}
} public class Main {


		public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	}
} Main
import java.util.Scanner;

public class Main {


		public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		
		int flg = 0;
		
		String s = scan.nextLine();//??????????????????
		String p = scan.nextLine();//??????????????????
		
		String s2 = s + s;//s???2?????£????????????
		
		int s2_len = s2.length();
		int p_len = p.length();
		
		for(int s2_cnt = 0; s2_cnt < s2_len - p_len; s2_cnt++){
			
			int ans_cnt = 0;
				
			for(int p_cnt = 0; p_cnt < p_len; p_cnt++){
				if(p.charAt(p_cnt) == s2.charAt(s2_cnt + p_cnt)){
					ans_cnt++;
					if(ans_cnt == p_len){
						flg = 1;
					}
				}
			}
		}
		if(flg == 1)
			System.out.println("Yes");
		else
			System.out.println("No");
		//????§????
		scan.close();
	}
}