import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
} import java.util.*; util.* java import java.io.*; io.* java import java.math.*; math.* java import static java.lang.Math.*; import static java.lang.Math.*; import static java.lang.Math.*; import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Arrays.*; import static java.util.Collections.*; import static java.util.Collections.*; import static java.util.Collections.*; public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
} Main static final long mod=1000000007; mod 1000000007 public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    } main {
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    } Reader sc = new Reader(System.in); sc new Reader(System.in) PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) String s=sc.nextString() s sc.nextString() sc.nextString sc ss=sc.nextString() ss sc.nextString() sc.nextString sc ans="No"; ans "No" char c[]=s.toCharArray(); c s.toCharArray() s.toCharArray s int n = c.length; n c.length c c.length for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        } {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        } String x=""; x "" for(int t=i; t<n; t++) {
                x+=c[t];
            } int t=i; int t=i; t i t<n t n t++ t++ t {
                x+=c[t];
            } {
                x+=c[t];
            } x+=c[t] x c[t] c t for(int t=0; t<i; t++) {
                x+=c[t];
            } int t=0; int t=0; t 0 t<i t i t++ t++ t {
                x+=c[t];
            } {
                x+=c[t];
            } x+=c[t] x c[t] c t if(x.equals(ss)){ans="Yes";break;} x.equals(ss) x.equals x ss {ans="Yes";break;} ans="Yes" ans "Yes" break; out.println(ans) out.println out ans out.flush() out.flush out String[] args args static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    } db {
        System.err.println(Arrays.deepToString(os));
    } System.err.println(Arrays.deepToString(os)) System.err.println System.err System System.err Arrays.deepToString(os) Arrays.deepToString Arrays os Object... os os static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    } validpos {
        return x<r && 0<=x && y<c && 0<=y;
    } return x<r && 0<=x && y<c && 0<=y; x<r && 0<=x && y<c && 0<=y y<c x<r && 0<=x && y<c && 0<=y x<r x r 0<=x 0 x y<c y c 0<=y 0 y int x x int y y int r r int c c static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    } bit {
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    } return  ( 0 < ( (x>>k) & 1 )  )  ? true:false; ( 0 < ( (x>>k) & 1 )  )  ? true:false ( 0 < ( (x>>k) & 1 )  ) 0 ( (x>>k) & 1 ) (x>>k) x k 1 true false long x x int k k class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    } P int id id d; d P(int  id, int d) {
            this.id=id;
            this.d=d;
        } P {
            this.id=id;
            this.d=d;
        } this.id=id this.id this this.id id this.d=d this.d this this.d d int  id id int d d public int compareTo(P p){
            return d-p.d; //descend
        } compareTo {
            return d-p.d; //descend
        } return d-p.d; //descend d-p.d d p.d p p.d P p p Comparable class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
} Reader private BufferedReader x; x private StringTokenizer st; st public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    } Reader {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    } x = new BufferedReader(new InputStreamReader(in)) x new BufferedReader(new InputStreamReader(in)) st = null st null InputStream in in public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    } nextString {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    } while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine()); st==null || !st.hasMoreTokens() st==null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(x.readLine()) st new StringTokenizer(x.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    } nextInt {
        return Integer.parseInt(nextString());
    } return Integer.parseInt(nextString()); Integer.parseInt(nextString()) Integer.parseInt Integer nextString() nextString public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    } nextLong {
        return Long.parseLong(nextString());
    } return Long.parseLong(nextString()); Long.parseLong(nextString()) Long.parseLong Long nextString() nextString public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    } nextDouble {
        return Double.parseDouble(nextString());
    } return Double.parseDouble(nextString()); Double.parseDouble(nextString()) Double.parseDouble Double nextString() nextString public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
} public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
} Main
import java.util.*;
import java.io.*;
import java.math.*;
 
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}
        // int n=sc.nextInt();


        String s=sc.nextString(),ss=sc.nextString(),ans="No";
        char c[]=s.toCharArray();
        int n = c.length;
        for(int i=0; i<n; i++) {
            String x="";
            for(int t=i; t<n; t++) {
                x+=c[t];
            }
            for(int t=0; t<i; t++) {
                x+=c[t];
            }
            if(x.equals(ss)){ans="Yes";break;}
            // db(x);
        }


        out.println(ans);
        out.flush();
    }
    
    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }
     
    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }
    
    static boolean bit(long x,int k){
        // weather k-th bit (from right) be one or zero
        return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
    }    
}

class P implements Comparable<P>{
        int id, d;
        P(int  id, int d) {
            this.id=id;
            this.d=d;
        } 
          
        public int compareTo(P p){
            return d-p.d; //descend
        }
    }

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}