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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    } main {
        Scanner sc=new Scanner(System.in);
        String S=sc.next();
        String T=sc.next();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    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 int N=S.length(); N S.length() S.length S for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            }
        } int i=0; int i=0; i 0 i<N i N i++ i++ i {
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            }
        } {
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            }
        } for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            } int j=0; int j=0; j 0 j<N j N j++ j++ j {
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            } {
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            } if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                } S.charAt((i+j)%N)==T.charAt(j%N) S.charAt((i+j)%N) S.charAt S (i+j)%N (i+j) i j N T.charAt(j%N) T.charAt T j%N j N {
                } {
                    break;
                } break; if(j==N-1){
                    System.out.println("Yes");
                    return;
                } j==N-1 j N-1 N 1 {
                    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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    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();
        int N=S.length();
        
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                if(S.charAt((i+j)%N)==T.charAt(j%N)){
                }else{
                    break;
                }
                if(j==N-1){
                    System.out.println("Yes");
                    return;
                }
            }
        }
        System.out.println("No");
    }
}
