import java.util.*;
//import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;
//import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	}
} import java.util.*; util.* java import static java.lang.System.*; import static java.lang.System.*; import static java.lang.System.*; public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	}
} Main public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	} main {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	} int i i j; j Scanner sc = new Scanner(in); sc new Scanner(in) char[] s = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char[] t = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc sc.close() sc.close sc char[] s2 = new char[s.length*2]; s2 new char[s.length*2] s.length*2 s.length s s.length 2 arraycopy(s, 0, s2, 0, s.length) arraycopy s 0 s2 0 s.length s s.length arraycopy(s, 0, s2, s.length, s.length) arraycopy s 0 s2 s.length s s.length s.length s s.length boolean f = false; f false for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		} i = 1; i = 1 i 1 i <= s.length i s.length s s.length i++ i++ i {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		} {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		} boolean f2 = true; f2 true for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			} j = 0; j = 0 j 0 j < s.length j s.length s s.length j++ j++ j {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			} {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			} if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				} s2[i+j] != t[j] s2[i+j] s2 i+j i j t[j] t j {
					f2 = false;
					break;
				} f2 = false f2 false break; if(f2) {
				f = true;
				break;
			} f2 {
				f = true;
				break;
			} f = true f true break; out.println(f?"Yes":"No") out.println out f?"Yes":"No" f "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	}
} public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	}
} Main
import java.util.*;
//import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.System.*;
//import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		char[] s = sc.next().toCharArray();
		char[] t = sc.next().toCharArray();
		sc.close();
		char[] s2 = new char[s.length*2];
		arraycopy(s, 0, s2, 0, s.length);
		arraycopy(s, 0, s2, s.length, s.length);
		boolean f = false;
		for (i = 1; i <= s.length; i++) {
			boolean f2 = true;
			for (j = 0; j < s.length; j++) {
				if(s2[i+j] != t[j]) {
					f2 = false;
					break;
				}
			}
			if(f2) {
				f = true;
				break;
			}
		}
		out.println(f?"Yes":"No");
	}
}
