import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	}
} Main public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	} main {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) char[] S = scn.nextLine().toCharArray(); S scn.nextLine().toCharArray() scn.nextLine().toCharArray scn.nextLine() scn.nextLine scn char[] T = scn.nextLine().toCharArray(); T scn.nextLine().toCharArray() scn.nextLine().toCharArray scn.nextLine() scn.nextLine scn boolean can = false can false b = false; b false for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		} int i = 0; int i = 0; i 0 i < S.length i S.length S S.length i++ i++ i {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		} {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		} b = false b false for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			} int j = 0; int j = 0; j 0 j < S.length j S.length S S.length j++ j++ j {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			} {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			} if(S[j] != T[j]) {
					b = true;
					break;
				} S[j] != T[j] S[j] S j T[j] T j {
					b = true;
					break;
				} b = true b true break; if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			} !b b {
				can = true;
				break;
			} can = true can true break; {
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			} char buf = T[0]; buf T[0] T 0 for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				} int j = 0; int j = 0; j 0 j < T.length-1 j T.length-1 T.length T T.length 1 j++ j++ j {
					T[j] = T[j+1];
				} {
					T[j] = T[j+1];
				} T[j] = T[j+1] T[j] T j T[j+1] T j+1 j 1 T[T.length-1] = buf T[T.length-1] T T.length-1 T.length T T.length 1 buf System.out.println(can?"Yes":"No") System.out.println System.out System System.out can?"Yes":"No" can "Yes" "No" scn.close() scn.close scn String args[] args public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	}
} public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner scn = new Scanner(System.in);
		char[] S = scn.nextLine().toCharArray();
		char[] T = scn.nextLine().toCharArray();
		boolean can = false,b = false;
		for(int i = 0;i < S.length;i++) {
			b = false;
			for(int j = 0;j < S.length;j++) {
				if(S[j] != T[j]) {
					b = true;
					break;
				}
			}
			if(!b) {
				can = true;
				break;
			}else{
				char buf = T[0];
				for(int j = 0;j < T.length-1;j++) {
					T[j] = T[j+1];
				}
				T[T.length-1] = buf;
			}
		}
		System.out.println(can?"Yes":"No");
		scn.close();
	}
}
