import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char[] s = br.readLine().toCharArray(); s br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char[] t = br.readLine().toCharArray(); t br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br br.close() br.close br char[] ss = new char[s.length * 2]; ss new char[s.length * 2] s.length * 2 s.length s s.length 2 System.arraycopy(s, 0, ss, 0, s.length) System.arraycopy System s 0 ss 0 s.length s s.length System.arraycopy(s, 0, ss, s.length, s.length) System.arraycopy System s 0 ss s.length s s.length s.length s s.length for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < t.length i t.length t t.length i++ i++ i {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		} {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		} boolean flg = true; flg true for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			} int j = 0; int j = 0; j 0 j < t.length j t.length t t.length j++ j++ j {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			} {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			} if (ss[i + j] != t[j]) {
					flg = false;
					break;
				} ss[i + j] != t[j] ss[i + j] ss i + j i j t[j] t j {
					flg = false;
					break;
				} flg = false flg false break; if (flg) {
				System.out.println("Yes");
				return;
			} flg {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] s = br.readLine().toCharArray();
		char[] t = br.readLine().toCharArray();
		br.close();

		char[] ss = new char[s.length * 2];
		System.arraycopy(s, 0, ss, 0, s.length);
		System.arraycopy(s, 0, ss, s.length, s.length);

		for (int i = 0; i < t.length; i++) {
			boolean flg = true;
			for (int j = 0; j < t.length; j++) {
				if (ss[i + j] != t[j]) {
					flg = false;
					break;
				}
			}
			if (flg) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}
