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();
		boolean possible = false;

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

	}
} 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();
		boolean possible = false;

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

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

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

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

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

	} 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 boolean possible = false; possible false for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		} 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.substring(0, 1);
			if (S.equals(T)) possible = true;
		} {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		} S = S.substring(1) + S.substring(0, 1) S S.substring(1) + S.substring(0, 1) S.substring(1) S.substring S 1 S.substring(0, 1) S.substring S 0 1 if (S.equals(T)) possible = true; S.equals(T) S.equals S T possible = true possible true if (possible) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} possible {
			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" 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();
		boolean possible = false;

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

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

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

	}
} 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();
		boolean possible = false;

		for (int i = 0; i < S.length(); i++) {
			S = S.substring(1) + S.substring(0, 1);
			if (S.equals(T)) possible = true;
		}

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

	}
}
