import java.io.*;
import java.util.*;

public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
}

class Solver
{
    String patten,target;
    boolean winFlag;
    public Solver(String s1,String s2)
    {
        patten=s1;
        target=s2;
        winFlag=false;
    }
    public void solve()
    {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } 
    public void approach()
    {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    }
    
} import java.io.*; io.* java import java.util.*; util.* java public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
} Main public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    } main {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    } try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        } catch(IOException e )
        {
            System.exit(0);
        } IOException e {
            System.exit(0);
        } System.exit(0) System.exit System 0 {
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        } BufferedReader bf=new BufferedReader(new InputStreamReader(System.in)); bf new BufferedReader(new InputStreamReader(System.in)) String msg1 msg1 msg2; msg2 msg1=bf.readLine() msg1 bf.readLine() bf.readLine bf msg2=bf.readLine() msg2 bf.readLine() bf.readLine bf Solver s = new Solver(msg1,msg2); s new Solver(msg1,msg2) s.solve() s.solve s s.approach() s.approach s String[] argv argv class Solver
{
    String patten,target;
    boolean winFlag;
    public Solver(String s1,String s2)
    {
        patten=s1;
        target=s2;
        winFlag=false;
    }
    public void solve()
    {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } 
    public void approach()
    {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    }
    
} Solver String patten patten target; target boolean winFlag; winFlag public Solver(String s1,String s2)
    {
        patten=s1;
        target=s2;
        winFlag=false;
    } Solver {
        patten=s1;
        target=s2;
        winFlag=false;
    } patten=s1 patten s1 target=s2 target s2 winFlag=false winFlag false String s1 s1 String s2 s2 public void solve()
    {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } solve {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } String tmp = target+target; tmp target+target target target for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        } int i=0; int i=0; i 0 i<patten.length() i patten.length() patten.length patten i++ i++ i {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        } {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        } winFlag=true winFlag true for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            } int j=0; int j=0; j 0 j<patten.length() j patten.length() patten.length patten j++ j++ j {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            } {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            } if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false; tmp.charAt(i+j)!=patten.charAt(j) tmp.charAt(i+j) tmp.charAt tmp i+j i j patten.charAt(j) patten.charAt patten j winFlag=false winFlag false if(winFlag==true)
                break; winFlag==true winFlag true break; public void approach()
    {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    } approach {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    } if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No"); winFlag==true winFlag true 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" public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
} public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
} Main
import java.io.*;
import java.util.*;

public class Main
{
    public static void main(String[] argv)
    {
        try{
        BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
        String msg1,msg2;
        msg1=bf.readLine();
        msg2=bf.readLine();
        Solver s = new Solver(msg1,msg2);
        s.solve();
        s.approach();
        }
        catch(IOException e )
        {
            System.exit(0);
        }
    }
}

class Solver
{
    String patten,target;
    boolean winFlag;
    public Solver(String s1,String s2)
    {
        patten=s1;
        target=s2;
        winFlag=false;
    }
    public void solve()
    {
        String tmp = target+target;
        for( int i=0;i<patten.length();i++)
        {
            winFlag=true;
            for(int j=0;j<patten.length();j++)
            {
                if(tmp.charAt(i+j)!=patten.charAt(j))
                    winFlag=false;
            }
            if(winFlag==true)
                break;
        }

    } 
    public void approach()
    {
        if(winFlag==true)
            System.out.println("Yes");
        else
            System.out.println("No");
            
    }
    
}
