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 l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    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.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    System.out.println(ans);
    
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    System.out.println(ans);
    
  } main {
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    System.out.println(ans);
    
  } 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 l = ""; l "" String r = ""; r "" int n = s.length(); n s.length() s.length s String ans =""; ans "" if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    } s.equals(t) s.equals s t {
      ans = "Yes";
    } ans = "Yes" ans "Yes" {
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    } for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    } int i = n-1 ; int i = n-1 ; i n-1 n 1 i > 0 i 0 --i --i i {
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    } {
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    } r = s.substring(i) r s.substring(i) s.substring s i l = s.substring(0,i) l s.substring(0,i) s.substring s 0 i if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      } (r+l).equals(t) (r+l).equals (r+l) r l t {
        ans = "Yes";
        break;
      } ans = "Yes" ans "Yes" break; {
        ans = "No";
      } ans = "No" ans "No" 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.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    System.out.println(ans);
    
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    String s = sc.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    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.next();
    String t = sc.next();
    
    String l = "";
    String r = "";
    
    int n = s.length();
    
    String ans ="";
    
    if(s.equals(t)){
      ans = "Yes";
    }else{
    for(int i = n-1 ; i > 0 ; --i){
      r = s.substring(i);
      l = s.substring(0,i);
      if((r+l).equals(t)){
        ans = "Yes";
        break;
      }else{
        ans = "No";
      }
    }
    }
    
    System.out.println(ans);
    
  }
}

