import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

} import java.util.Arrays; Arrays java.util import java.util.HashMap; HashMap java.util import java.util.Map; Map java.util import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

} Main public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String input = sc.next(); input sc.next() sc.next sc String txt = sc.next(); txt sc.next() sc.next sc input = input + input input input + input input input System.out.println(input.contains(txt) ? "Yes" : "No") System.out.println System.out System System.out input.contains(txt) ? "Yes" : "No" input.contains(txt) input.contains input txt "Yes" "No" String args[] args public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

} public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

} Main
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		String input = sc.next();
		String txt = sc.next();
		
		input = input + input;
		
		System.out.println(input.contains(txt) ? "Yes" : "No");
	}

}