import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	}

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

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	}

} Main public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	} main {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	} @SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in); scan new Scanner(System.in) while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		} scan.hasNextLine() scan.hasNextLine scan {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		} String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan s = s.concat(s) s s.concat(s) s.concat s s if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No"); s.contains(p) s.contains s p System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" System.exit(0) System.exit System 0 String[] args args public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	}

} public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);

		while (scan.hasNextLine()) {
			String s = scan.nextLine();
			String p = scan.nextLine();

			s = s.concat(s);

			if (s.contains(p))
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		System.exit(0);
	}

}