
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	}
} Main public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	} main {
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	} Scanner in = new java.util.Scanner(System.in); in new java.util.Scanner(System.in) char[] S = in.nextLine().toCharArray(); S in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in char[] T = in.nextLine().toCharArray(); T in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in int count = 0; count 0 for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		} int i=0; int i=0; i 0 i<S.length i S.length S S.length i++ i++ i {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		} {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		} count = 0 count 0 for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			} int j=0; int j=0; j 0 j<T.length - i j T.length - i T.length T T.length i j++ j++ j {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			} {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			} if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				} (int)S[j] == (int)T[j+i] (int)S[j] S j (int)T[j+i] T j+i j i {
					count++;
				} count++ count {
					break;
				} break; for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			} int j=T.length-i, k=0; int j=T.length-i j T.length-i T.length T T.length i k=0; k 0 j<T.length j T.length T T.length j++,k++ j++ j k++ k {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			} {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			} if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				} (int)S[j] == (int)T[k] (int)S[j] S j (int)T[k] T k {
					count++;
				} count++ count {
					break;
				} break; if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			} count == S.length count S.length S S.length {
				System.out.print("Yes");
				System.exit(0);
			} System.out.print("Yes") System.out.print System.out System System.out "Yes" System.exit(0) System.exit System 0 System.out.print("No") System.out.print System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	}
} public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	}
} Main

import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner in = new java.util.Scanner(System.in);
		char[] S = in.nextLine().toCharArray();
		char[] T = in.nextLine().toCharArray();
		
		int count = 0;
		for(int i=0; i<S.length; i++) {
			count = 0;
			
			for(int j=0; j<T.length - i; j++) {
				if((int)S[j] == (int)T[j+i]) {
					count++;
				}else {
					break;
				}
			}
			for(int j=T.length-i, k=0; j<T.length; j++,k++) {
				if((int)S[j] == (int)T[k]) {
					count++;
				}else {
					break;
				}
			}
			if(count == S.length) {
				System.out.print("Yes");
				System.exit(0);
			}
		}
		System.out.print("No");
		
	}
}