import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	} main {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) char[] str1 = in.nextLine().toCharArray(); str1 in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in char[] str2 = in.nextLine().toCharArray(); str2 in.nextLine().toCharArray() in.nextLine().toCharArray in.nextLine() in.nextLine in if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} check(str1, str2) check str1 str2 {
			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" in.close() in.close in String[] args args private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	} check {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	} for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		} int i = 0; int i = 0; i 0 i < str1.length i str1.length str1 str1.length ++i ++i i {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		} {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		} char[] rotateStr = rotate(str2, i); rotateStr rotate(str2, i) rotate str2 i if (compare(str1, rotateStr) == true) {
				return true;
			} compare(str1, rotateStr) == true compare(str1, rotateStr) compare str1 rotateStr true {
				return true;
			} return true; true return false; false char[] str1 str1 char[] str2 str2 private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	} compare {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	} for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		} int i = 0; int i = 0; i 0 i < str1.length i str1.length str1 str1.length ++i ++i i {
			if (str1[i] != str2[i]) {
				return false;
			}
		} {
			if (str1[i] != str2[i]) {
				return false;
			}
		} if (str1[i] != str2[i]) {
				return false;
			} str1[i] != str2[i] str1[i] str1 i str2[i] str2 i {
				return false;
			} return false; false return true; true char[] str1 str1 char[] str2 str2 private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	} rotate {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	} char[] result = new char[str.length]; result new char[str.length] str.length str str.length int index = 0; index 0 for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		} int i = startIndex; int i = startIndex; i startIndex i < str.length i str.length str str.length ++i ++i i {
			result[index] = str[i];
			++index;
		} {
			result[index] = str[i];
			++index;
		} result[index] = str[i] result[index] result index str[i] str i ++index index for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		} int i = 0; int i = 0; i 0 i < startIndex i startIndex ++i ++i i {
			result[index] = str[i];
			++index;
		} {
			result[index] = str[i];
			++index;
		} result[index] = str[i] result[index] result index str[i] str i ++index index return result; result char[] str str int startIndex startIndex public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

} public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] str1 = in.nextLine().toCharArray();
		char[] str2 = in.nextLine().toCharArray();
		if (check(str1, str2)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		in.close();
	}

	private static boolean check(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			char[] rotateStr = rotate(str2, i);
			if (compare(str1, rotateStr) == true) {
				return true;
			}
		}
		return false;
	}

	private static boolean compare(char[] str1, char[] str2) {
		for (int i = 0; i < str1.length; ++i) {
			if (str1[i] != str2[i]) {
				return false;
			}
		}
		return true;
	}

	private static char[] rotate(char[] str, int startIndex) {
		char[] result = new char[str.length];
		int index = 0;
		for (int i = startIndex; i < str.length; ++i) {
			result[index] = str[i];
			++index;
		}
		for (int i = 0; i < startIndex; ++i) {
			result[index] = str[i];
			++index;
		}
		return result;
	}

}