import java.io.*;
import java.util.*;
class Program{
    char[] change(char c[]){
        char temp = '\0', chng = c[c.length-1];
        for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        }
        return c;
    }
}
class Main{
    public static void main(String args[])throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Program obj = new Program();
        String S = in.readLine(), T = in.readLine();
        char s []= S.toCharArray(), t[] = T.toCharArray();
        boolean flag = false;
        for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        }
        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.io.*; io.* java import java.util.*; util.* java class Program{
    char[] change(char c[]){
        char temp = '\0', chng = c[c.length-1];
        for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        }
        return c;
    }
} Program char[] change(char c[]){
        char temp = '\0', chng = c[c.length-1];
        for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        }
        return c;
    } change {
        char temp = '\0', chng = c[c.length-1];
        for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        }
        return c;
    } char temp = '\0' temp '\0' chng = c[c.length-1]; chng c[c.length-1] c c.length-1 c.length c c.length 1 for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        } int i = 0; int i = 0; i 0 i<c.length i c.length c c.length i++ i++ i {
            temp = c[i];
            c[i] = chng;
            chng = temp;
        } {
            temp = c[i];
            c[i] = chng;
            chng = temp;
        } temp = c[i] temp c[i] c i c[i] = chng c[i] c i chng chng = temp chng temp return c; c char c[] c class Main{
    public static void main(String args[])throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Program obj = new Program();
        String S = in.readLine(), T = in.readLine();
        char s []= S.toCharArray(), t[] = T.toCharArray();
        boolean flag = false;
        for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        }
        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String args[])throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Program obj = new Program();
        String S = in.readLine(), T = in.readLine();
        char s []= S.toCharArray(), t[] = T.toCharArray();
        boolean flag = false;
        for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        }
        if (flag) System.out.println("Yes");
        else System.out.println("No");
    } main {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Program obj = new Program();
        String S = in.readLine(), T = in.readLine();
        char s []= S.toCharArray(), t[] = T.toCharArray();
        boolean flag = false;
        for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        }
        if (flag) System.out.println("Yes");
        else System.out.println("No");
    } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) Program obj = new Program(); obj new Program() String S = in.readLine() S in.readLine() in.readLine in T = in.readLine(); T in.readLine() in.readLine in char s []= S.toCharArray() s S.toCharArray() S.toCharArray S t[] = T.toCharArray(); t T.toCharArray() T.toCharArray T boolean flag = false; flag false for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        } int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        } {
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        } if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            } Arrays.toString(obj.change(s)).equals(Arrays.toString(t)) Arrays.toString(obj.change(s)).equals Arrays.toString(obj.change(s)) Arrays.toString Arrays obj.change(s) obj.change obj s Arrays.toString(t) Arrays.toString Arrays t {
                flag = true;
                break;
            } flag = true flag true break; if (flag) System.out.println("Yes");
        else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String args[] args
import java.io.*;
import java.util.*;
class Program{
    char[] change(char c[]){
        char temp = '\0', chng = c[c.length-1];
        for(int i = 0;i<c.length;i++){
            temp = c[i];
            c[i] = chng;
            chng = temp;
        }
        return c;
    }
}
class Main{
    public static void main(String args[])throws IOException{
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        Program obj = new Program();
        String S = in.readLine(), T = in.readLine();
        char s []= S.toCharArray(), t[] = T.toCharArray();
        boolean flag = false;
        for(int i=0;i<s.length;i++){
            //System.out.println(Arrays.toString(obj.change(s)));
            if (Arrays.toString(obj.change(s)).equals(Arrays.toString(t))){
                flag = true;
                break;
            }
        }
        if (flag) System.out.println("Yes");
        else System.out.println("No");
    }
}