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();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "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();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "No");
        
        
        
    }
} Main public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "No");
        
        
        
    } main {

        Scanner sc = new Scanner(System.in);
        
        String S = sc.next();
        String T = sc.next();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "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 boolean isOK = false; isOK false for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        } int i = S.length(); int i = S.length(); i S.length() S.length S i >= 0 i 0 i-- i-- i {
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        } {
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        } String left = S.substring(0, i); left S.substring(0, i) S.substring S 0 i String right =S.substring(i, S.length()); right S.substring(i, S.length()) S.substring S i S.length() S.length S if( T.equals(right + left) ){
                isOK = true;
                break;
            } T.equals(right + left) T.equals T right + left right left {
                isOK = true;
                break;
            } isOK = true isOK true break; System.out.println( isOK ? "Yes" : "No") System.out.println System.out System System.out isOK ? "Yes" : "No" isOK "Yes" "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();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "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();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "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();
        boolean isOK = false;
        
        for(int i = S.length(); i >= 0; i--){
            
            String left = S.substring(0, i);
            String right =S.substring(i, S.length());
            if( T.equals(right + left) ){
                isOK = true;
                break;
            }
        }
        
        System.out.println( isOK ? "Yes" : "No");
        
        
        
    }
}
