
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	} main {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan String result1 = ""; result1 "" String result2 =""; result2 "" String result3 = ""; result3 "" String ans = "No"; ans "No" for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		} int j = 0; int j = 0; j 0 j < S.length() j S.length() S.length S j++ j++ j {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		} {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		} result1=S.substring(0, j) result1 S.substring(0, j) S.substring S 0 j result2=S.substring(j) result2 S.substring(j) S.substring S j result3=(result2+result1) result3 (result2+result1) result2 result1 if (result3.equals(T)) {
				ans = "Yes";
				break;
			} result3.equals(T) result3.equals result3 T {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; result1 = "" result1 "" result2 = "" result2 "" result3 = "" result3 "" System.out.println(ans) System.out.println System.out System System.out ans scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String S = scan.next();
		String T = scan.next();
		String result1 = "";
		String result2 ="";
		String result3 = "";
		String ans = "No";

		for (int j = 0; j < S.length() ; j++) {

			result1=S.substring(0, j);
			result2=S.substring(j);
			result3=(result2+result1);

			if (result3.equals(T)) {
				ans = "Yes";
				break;
			}
			result1 = "";
			result2 = "";
			result3 = "";

		}
		System.out.println(ans);
		scan.close();

	}
}
