import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  }
} import java.util.*; util.* java public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  }
} Main public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc int n = S.length(); n S.length() S.length S String ans = "No"; ans "No" for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    } {
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    } if(S.equals(T)){
        ans = "Yes";
        break;
      } S.equals(T) S.equals S T {
        ans = "Yes";
        break;
      } ans = "Yes" ans "Yes" break; String s1 = new String(S.substring(0,1)); s1 new String(S.substring(0,1)) String s2 = new String(S.substring(1,n)); s2 new String(S.substring(1,n)) S = s2+s1 S s2+s1 s2 s1 System.out.println(ans) System.out.println System.out System System.out ans String[]args args public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  }
} public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  }
} Main
import java.util.*;

public class Main{
  public static void main(String[]args){
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    String T = sc.nextLine();
    int n = S.length();
    
    String ans = "No";
    for(int i = 0; i <= n; i++){
      if(S.equals(T)){
        ans = "Yes";
        break;
      }
      
      String s1 = new String(S.substring(0,1));
      String s2 = new String(S.substring(1,n));
      S = s2+s1;
    }
    System.out.println(ans);
  }
}