import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String t = sc.nextLine(); t sc.nextLine() sc.nextLine sc boolean ret = false; ret false String tPrefix = t.substring(0, 1); tPrefix t.substring(0, 1) t.substring t 0 1 String checkString = s; checkString s int prefIndex = checkString.indexOf(tPrefix); prefIndex checkString.indexOf(tPrefix) checkString.indexOf checkString tPrefix while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		} true {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		} checkString = s.substring(prefIndex) checkString s.substring(prefIndex) s.substring s prefIndex if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			} t.equals(checkString + s.substring(0, prefIndex)) t.equals t checkString + s.substring(0, prefIndex) checkString s.substring(0, prefIndex) s.substring s 0 prefIndex {
				ret = true;
				break;
			} ret = true ret true break; if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			} checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1 checkString.length() <= 1 checkString.length() checkString.length checkString 1 checkString.substring(1).indexOf(tPrefix) == -1 checkString.substring(1).indexOf(tPrefix) checkString.substring(1).indexOf checkString.substring(1) checkString.substring checkString 1 tPrefix -1 1 {
				break;
			} break; prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1) prefIndex (checkString.substring(1).indexOf(tPrefix) + 1) checkString.substring(1).indexOf(tPrefix) checkString.substring(1).indexOf checkString.substring(1) checkString.substring checkString 1 tPrefix 1 if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} ret {
			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" sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();

		boolean ret = false;
		String tPrefix = t.substring(0, 1);
		String checkString = s;
		int prefIndex = checkString.indexOf(tPrefix);
		while (true) {
			checkString = s.substring(prefIndex);
			if (t.equals(checkString + s.substring(0, prefIndex))) {
				ret = true;
				break;
			}
			if (checkString.length() <= 1 || checkString.substring(1).indexOf(tPrefix) == -1) {
				break;
			}
			prefIndex += (checkString.substring(1).indexOf(tPrefix) + 1);
		}

		if (ret) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		sc.close();
	}
}