import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    }
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    } main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc String log[] = s.split(""); log s.split("") s.split s "" String tmt; tmt String ans; ans int i; i int count = 1; count 1 if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        } s.equals(t) s.equals s t {
           System.out.println("Yes");
           System.exit(0);
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        } count != s.length() count s.length() s.length s {
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        } tmt = log[s.length() - 1] tmt log[s.length() - 1] log s.length() - 1 s.length() s.length s 1 for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	} i = s.length() - 2; i = s.length() - 2 i s.length() - 2 s.length() s.length s 2 i >= 0 i 0 i -- i -- i {
          		log[i + 1] = log[i];         
        	} {
          		log[i + 1] = log[i];         
        	} log[i + 1] = log[i] log[i + 1] log i + 1 i 1 log[i] log i log[0] = tmt log[0] log 0 tmt StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              } i=0; i=0 i 0 i <s.length() i s.length() s.length s i++ i++ i {
              sb.append(log[i]);
              } {
              sb.append(log[i]);
              } sb.append(log[i]) sb.append sb log[i] log i ans = sb.toString() ans sb.toString() sb.toString sb if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            } ans.equals(t) ans.equals ans t {
              System.out.println("Yes");
              System.exit(0);
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 count += 1 count 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){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    }
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    }
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		String s = sc.next();
		String t = sc.next();
      	String log[] = s.split("");
        String tmt;
        String ans;
        int i;
        int count = 1;
		if(s.equals(t)){
           System.out.println("Yes");
           System.exit(0);
        }
      	
        while(count != s.length()){
            tmt = log[s.length() - 1];
     		for(i = s.length() - 2; i >= 0; i --){
          		log[i + 1] = log[i];         
        	}
          	log[0] = tmt;
          
          	StringBuilder sb = new StringBuilder();
            for(i=0;i <s.length(); i++){
              sb.append(log[i]);
              }
            ans = sb.toString();
            if(ans.equals(t)){
              System.out.println("Yes");
              System.exit(0);
            }
            count += 1;
        }
              System.out.println("No");        
    }
}