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