import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	}
} Main public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	} main {
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	} Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String s = scn.next(); s scn.next() scn.next scn String t = scn.next(); t scn.next() scn.next scn for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		} {
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		} if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    } s.equals(t) s.equals s t {
		        System.out.println("Yes");
		        return;
		    } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    } s = s.charAt(s.length()-1) + s.substring(0, s.length()-1) s s.charAt(s.length()-1) + s.substring(0, s.length()-1) s.charAt(s.length()-1) s.charAt s s.length()-1 s.length() s.length s 1 s.substring(0, s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
		String t = scn.next();
		for(int i=0; i<s.length(); i++){
		    if(s.equals(t)){
		        System.out.println("Yes");
		        return;
		    }else{
		        s = s.charAt(s.length()-1) + s.substring(0, s.length()-1);
		    }
		}
      	System.out.println("No");
	}
}
