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

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
} Main public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	} main {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	} try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		} Exception e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) char[] ring = input.readLine().toCharArray(); ring input.readLine().toCharArray() input.readLine().toCharArray input.readLine() input.readLine input char[] pattern = input.readLine().toCharArray(); pattern input.readLine().toCharArray() input.readLine().toCharArray input.readLine() input.readLine input boolean flag = false; flag false int tmp; tmp for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			} int i = 0; int i = 0; i 0 i < ring.length i ring.length ring ring.length i++ i++ i {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			} {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			} tmp = i tmp i for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				} int j = 0; int j = 0; j 0 j < pattern.length j pattern.length pattern pattern.length tmp++, j++ tmp++ tmp j++ j {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				} {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				} if (tmp == ring.length) {
						tmp = 0;
					} tmp == ring.length tmp ring.length ring ring.length {
						tmp = 0;
					} tmp = 0 tmp 0 if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					} ring[tmp] != pattern[j] ring[tmp] ring tmp pattern[j] pattern j {
						break;
					} break; if (j == pattern.length-1) {
						flag = true;
					} j == pattern.length-1 j pattern.length-1 pattern.length pattern pattern.length 1 {
						flag = true;
					} flag = true flag true if (flag) {
					break;
				} flag {
					break;
				} break; System.out.println(flag ? "Yes" : "No") System.out.println System.out System System.out flag ? "Yes" : "No" flag "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
} public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
			char[] ring = input.readLine().toCharArray();
			char[] pattern = input.readLine().toCharArray();
			boolean flag = false;

			int tmp;
			for (int i = 0; i < ring.length; i++) {
				tmp = i;
				for (int j = 0; j < pattern.length; tmp++, j++) {
					if (tmp == ring.length) {
						tmp = 0;
					}

					if (ring[tmp] != pattern[j]) {
						break;
					} else if (j == pattern.length-1) {
						flag = true;
					}
				}
				if (flag) {
					break;
				}
			}
			System.out.println(flag ? "Yes" : "No");
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
}