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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s1 s1 s2 s2 checkStr; checkStr boolean ans = false; ans false int s1Length s1Length s2Length; s2Length s1 = in.readLine() s1 in.readLine() in.readLine in s2 = in.readLine() s2 in.readLine() in.readLine in s1Length = s1.length() s1Length s1.length() s1.length s1 s2Length = s2.length() s2Length s2.length() s2.length s2 for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		} int i = 0; int i = 0; i 0 i < s1Length i s1Length i++ i++ i {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		} {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		} if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			} s1.charAt(i) == s2.charAt(0) s1.charAt(i) s1.charAt s1 i s2.charAt(0) s2.charAt s2 0 {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			} if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				} (i + 1) + s2Length > s1Length (i + 1) + s2Length (i + 1) i 1 s2Length s1Length {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i)) checkStr s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i)) s1.substring(i, s1Length) s1.substring s1 i s1Length s1.substring(0, s2Length - (s1Length - i)) s1.substring s1 0 s2Length - (s1Length - i) s2Length (s1Length - i) s1Length i {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				} checkStr = s1.substring(i, i + s2Length) checkStr s1.substring(i, i + s2Length) s1.substring s1 i i + s2Length i s2Length if (checkStr.matches(s2)) {
					ans = true;
				} checkStr.matches(s2) checkStr.matches checkStr s2 {
					ans = true;
				} ans = true ans true if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} ans {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} 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 IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String s1, s2, checkStr;
		boolean ans = false;
		int s1Length, s2Length;
		s1 = in.readLine();
		s2 = in.readLine();
		s1Length = s1.length();
		s2Length = s2.length();
		/*
		 * System.out .println("s1Length:" + s1Length +
		 * System.getProperty("line.separator") + "s2Length:" + s2Length);
		 */
		for (int i = 0; i < s1Length; i++) {
			if (s1.charAt(i) == s2.charAt(0)) {
				if ((i + 1) + s2Length > s1Length) {
					/*
					 * System.out.println("文字番" + (i + 1));
					 * System.out.println("範囲外文字列" + (s1.substring(i, s1Length)
					 * + s1.substring(0, s2Length - (s1Length - i))));
					 */
					checkStr = s1.substring(i, s1Length)
							+ s1.substring(0, s2Length - (s1Length - i));
				} else {
					/*
					 * System.out.println("文字番" + (i + 1)); System.out
					 * .println("範囲内文字列" + s1.substring(i, i + s2Length));
					 */
					checkStr = s1.substring(i, i + s2Length);
				}
				if (checkStr.matches(s2)) {
					ans = true;
				}
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}