import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            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 a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc char[] s = a.toCharArray(); s a.toCharArray() a.toCharArray a char[] t = b.toCharArray(); t b.toCharArray() b.toCharArray b char[] s2 =a.toCharArray(); s2 a.toCharArray() a.toCharArray a int cnt = 0; cnt 0 int cnt2 =0; cnt2 0 while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        } cnt<a.length() cnt a.length() a.length a {
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        } for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            } int i =0; int i =0; i 0 i<a.length() i a.length() a.length a i++ i++ i {
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            } {
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            } if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                } i==a.length()-1 i a.length()-1 a.length() a.length a 1 {
                    s2[0]=s[i];
                } s2[0]=s[i] s2[0] s2 0 s[i] s i {
                    s2[i+1]=s[i];
                } s2[i+1]=s[i] s2[i+1] s2 i+1 i 1 s[i] s i if(Arrays.equals(t,s2)){
                cnt2++;
            } Arrays.equals(t,s2) Arrays.equals Arrays t s2 {
                cnt2++;
            } cnt2++ cnt2 s=s2.clone() s s2.clone() s2.clone s2 cnt++ cnt if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } cnt2>0 cnt2 0 {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } 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 a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
} Main
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        char[] s = a.toCharArray();
        char[] t = b.toCharArray();
        char[] s2 =a.toCharArray();
        int cnt = 0;
        int cnt2 =0;
        //System.out.println(a.length());

        while(cnt<a.length()){
            for(int i =0;i<a.length();i++){
                if(i==a.length()-1){
                    s2[0]=s[i];
                }else{
                    s2[i+1]=s[i];
                }

            }
            //System.out.println(s2);
            if(Arrays.equals(t,s2)){
                cnt2++;
            }
            s=s2.clone();
            cnt++;
        }

        if(cnt2>0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}
