import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    } main {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       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 if(T.equals(S)){
               System.out.println("Yes");
               return;
           } T.equals(S) T.equals T S {
               System.out.println("Yes");
               return;
           } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       } int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       } {
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       } String U = S.substring(i,S.length())+S.substring(0,i); U S.substring(i,S.length())+S.substring(0,i) S.substring(i,S.length()) S.substring S i S.length() S.length S S.substring(0,i) S.substring S 0 i if(T.equals(U)){
               System.out.println("Yes");
               return;
           } T.equals(U) T.equals T U {
               System.out.println("Yes");
               return;
           } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
       Scanner sc = new Scanner(System.in);
       String S = sc.next();
       String T = sc.next();
       if(T.equals(S)){
               System.out.println("Yes");
               return;
           }
       for(int i=0;i<S.length();i++){
           String U = S.substring(i,S.length())+S.substring(0,i);
           //System.out.println(U);
           if(T.equals(U)){
               System.out.println("Yes");
               return;
           }
       }
       System.out.println("No");
    }
}
