import java.util.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    }
} import java.util.*; util.* java public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    }
} Main public static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    } main {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    } int i i j j k; k String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String s2 = s + s; s2 s + s s s String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	} s2.contains(p) s2.contains s2 p {
    		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 Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    }
} public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    }
} Main
import java.util.*;
public class Main {
    public static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
    	int i, j, k;
    	String s = sc.nextLine();
    	String s2 = s + s;
    	String p = sc.nextLine();
    	
    	if(s2.contains(p)) {
    		System.out.println("Yes");
    	}
    	else {
    		System.out.println("No");
    	}
    }
}
