import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

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

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} Main public static Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	} main {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	} String s = input(); s input() input String p = input(); p input() input s += s s s if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		} s.indexOf(p) != -1 s.indexOf(p) s.indexOf s p -1 1 {

			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" close() close String[] args args public static String input() {

		return scanner.nextLine();

	} input {

		return scanner.nextLine();

	} return scanner.nextLine(); scanner.nextLine() scanner.nextLine scanner public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	} close {

		if (scanner != null) {

			scanner.close();

		}
	} if (scanner != null) {

			scanner.close();

		} scanner != null scanner null {

			scanner.close();

		} scanner.close() scanner.close scanner public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static Scanner scanner = new Scanner(System.in);

	public static void main(String[] args) {

		String s = input();
		String p = input();

		s += s;

		if (s.indexOf(p) != -1) {

			System.out.println("Yes");

		} else {

			System.out.println("No");

		}

		close();

	}

	public static String input() {

		return scanner.nextLine();

	}

	public static void close() {

		if (scanner != null) {

			scanner.close();

		}
	}
}