import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	} main {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	} Scanner sc = null; sc null String output = "No"; output "No" try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		} {
			sc.close();
		} sc.close() sc.close sc {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} sc = new Scanner(System.in) sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String ring = str + str; ring str + str str str String check = sc.nextLine(); check sc.nextLine() sc.nextLine sc if (ring.indexOf(check) != -1) {
				output = "Yes";
			} ring.indexOf(check) != -1 ring.indexOf(check) ring.indexOf ring check -1 1 {
				output = "Yes";
			} output = "Yes" output "Yes" System.out.println(output) System.out.println System.out System System.out output String[] args args public class Main {

	public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = null;
		String output = "No";

		try {
			sc = new Scanner(System.in);

			String str = sc.nextLine();
			String ring = str + str;

			String check = sc.nextLine();

			if (ring.indexOf(check) != -1) {
				output = "Yes";
			}
			System.out.println(output);
		} finally {
			sc.close();
		}
	}

}