import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    }
} Main public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    } main {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String line2 = sc.nextLine(); line2 sc.nextLine() sc.nextLine sc int n=line.length(); n line.length() line.length line int n2=line2.length(); n2 line2.length() line2.length line2 if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      } n!=n2 n n2 {
        System.out.println("No");
      } System.out.println("No") System.out.println System.out System System.out "No" {
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      } int count=0; count 0 boolean f=false; f false while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	} count!=n count n {
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	} if(line.equals(line2)){
            	f=true;
              	break;
            } line.equals(line2) line.equals line line2 {
            	f=true;
              	break;
            } f=true f true break; String l=line.substring(0,1); l line.substring(0,1) line.substring line 0 1 line=line.substring(1,line.length()) line line.substring(1,line.length()) line.substring line 1 line.length() line.length line line+=l line l count++ count if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No"); f {
        	System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    }
} public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    }
} Main
import java.util.*;


public class Main {
    public static void main(String[] args) {
        // 自分の得意な言語で
        // Let's チャレンジ！！

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
      String line2 = sc.nextLine();
      int n=line.length();
      int n2=line2.length();
      if(n!=n2){
        System.out.println("No");
      }
      else{
        int count=0;
        boolean f=false;
      	while(count!=n){
      		if(line.equals(line2)){
            	f=true;
              	break;
            }
          String l=line.substring(0,1);
            line=line.substring(1,line.length());
          line+=l;
            count++;
      	}
        if(f){
        	System.out.println("Yes");
        }
        else System.out.println("No");
        
      }
 
    }
}