import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	}
} 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.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		} {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		} S = S.substring(1) + S.charAt(0) S S.substring(1) + S.charAt(0) S.substring(1) S.substring S 1 S.charAt(0) S.charAt S 0 if (S.equals(T)) {
				System.out.println("Yes");
				return;
			} S.equals(T) S.equals S T {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" return; String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.charAt(0);
			if (S.equals(T)) {
				System.out.println("Yes");
				return;
			}
		}

		System.out.println("No");

		return;
	}
}
