import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

		if (flg) {
			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 a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

		if (flg) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

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

		Scanner sc = new Scanner(System.in);

		String a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

		if (flg) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc boolean flg = false; flg false String[] str = a.split(""); str a.split("") a.split a "" for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		} int i = 0; int i = 0; i 0 i < str.length i str.length str str.length i++ i++ i {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		} {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		} StringBuffer sb = new StringBuffer(); sb new StringBuffer() sb.append(str[str.length-1]) sb.append sb str[str.length-1] str str.length-1 str.length str str.length 1 for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			} int j = 0; int j = 0; j 0 j < str.length-1 j str.length-1 str.length str str.length 1 j++ j++ j {

				sb.append(str[j]);
			} {

				sb.append(str[j]);
			} sb.append(str[j]) sb.append sb str[j] str j if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			} String.valueOf(sb).equals(b) String.valueOf(sb).equals String.valueOf(sb) String.valueOf String sb b {
				flg = true;
				break;
			} flg = true flg true break; str = String.valueOf(sb).split("") str String.valueOf(sb).split("") String.valueOf(sb).split String.valueOf(sb) String.valueOf String sb "" if (flg) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} flg {
			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 a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

		if (flg) {
			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 a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

		if (flg) {
			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 a = sc.next();
		String b = sc.next();

		boolean flg = false;

		String[] str = a.split("");



		for (int i = 0; i < str.length; i++) {

			StringBuffer sb = new StringBuffer();

			sb.append(str[str.length-1]);

			for(int j = 0; j < str.length-1; j++ ) {

				sb.append(str[j]);
			}

			if (String.valueOf(sb).equals(b)) {
				flg = true;
				break;
			}

			str = String.valueOf(sb).split("");

		}

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