import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

 class Main
 {
    static boolean ischeck(char[] xx,char[] yy)
    {
        for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        }
        return true;
    }
    static int fun(char[] X,char[] Y,int left)
    {
        int flag=0;
        if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0;
        return 0;
    }

    public static void main(String[] args) 
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        char[] x=s.toCharArray();
        char[] y=t.toCharArray();
        int flag=0;
        for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        }
        if(flag==1)
            System.out.println("Yes");
        else
            System.out.println("No");
        
    }
} import java.io.*; io.* java import java.math.*; math.* java import java.security.*; security.* java import java.text.*; text.* java import java.util.*; util.* java import java.util.concurrent.*; concurrent.* java.util import java.util.regex.*; regex.* java.util class Main
 {
    static boolean ischeck(char[] xx,char[] yy)
    {
        for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        }
        return true;
    }
    static int fun(char[] X,char[] Y,int left)
    {
        int flag=0;
        if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0;
        return 0;
    }

    public static void main(String[] args) 
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        char[] x=s.toCharArray();
        char[] y=t.toCharArray();
        int flag=0;
        for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        }
        if(flag==1)
            System.out.println("Yes");
        else
            System.out.println("No");
        
    }
} Main static boolean ischeck(char[] xx,char[] yy)
    {
        for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        }
        return true;
    } ischeck {
        for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        }
        return true;
    } for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        } int j=0; int j=0; j 0 j<xx.length j xx.length xx xx.length j++ j++ j {
            if(xx[j]!=yy[j])
                return false;
        } {
            if(xx[j]!=yy[j])
                return false;
        } if(xx[j]!=yy[j])
                return false; xx[j]!=yy[j] xx[j] xx j yy[j] yy j return false; false return true; true char[] xx xx char[] yy yy static int fun(char[] X,char[] Y,int left)
    {
        int flag=0;
        if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0;
        return 0;
    } fun {
        int flag=0;
        if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0;
        return 0;
    } int flag=0; flag 0 if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0; X.length==Y.length X.length X X.length Y.length Y Y.length {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        } char[] xx=new char[X.length]; xx new char[X.length] X.length X X.length for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            } int j=0; int j=0; j 0 j<X.length j X.length X X.length j++ j++ j {
                xx[(left+j)%X.length]=X[j];
            } {
                xx[(left+j)%X.length]=X[j];
            } xx[(left+j)%X.length]=X[j] xx[(left+j)%X.length] xx (left+j)%X.length (left+j) left j X.length X X.length X[j] X j if(ischeck(xx,Y))
            {
                return 1;
            } ischeck(xx,Y) ischeck xx Y {
                return 1;
            } return 1; 1 return 0; 0 return 0; 0 char[] X X char[] Y Y int left left public static void main(String[] args) 
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        char[] x=s.toCharArray();
        char[] y=t.toCharArray();
        int flag=0;
        for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        }
        if(flag==1)
            System.out.println("Yes");
        else
            System.out.println("No");
        
    } main {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        char[] x=s.toCharArray();
        char[] y=t.toCharArray();
        int flag=0;
        for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        }
        if(flag==1)
            System.out.println("Yes");
        else
            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 char[] x=s.toCharArray(); x s.toCharArray() s.toCharArray s char[] y=t.toCharArray(); y t.toCharArray() t.toCharArray t int flag=0; flag 0 for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        } {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        } if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0; fun(x,y,i)==1 fun(x,y,i) fun x y i 1 {
                flag=1;
                break;
           } flag=1 flag 1 break; flag=0 flag 0 if(flag==1)
            System.out.println("Yes");
        else
            System.out.println("No"); flag==1 flag 1 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.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

 class Main
 {
    static boolean ischeck(char[] xx,char[] yy)
    {
        for(int j=0;j<xx.length;j++)
        {
            if(xx[j]!=yy[j])
                return false;
        }
        return true;
    }
    static int fun(char[] X,char[] Y,int left)
    {
        int flag=0;
        if(X.length==Y.length)
        {
            char[] xx=new char[X.length];
            
            for(int j=0;j<X.length;j++)
            {
                xx[(left+j)%X.length]=X[j];
            }
            if(ischeck(xx,Y))
            {
                return 1;
            }   
        }
        else
            return 0;
        return 0;
    }

    public static void main(String[] args) 
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String t=sc.next();
        char[] x=s.toCharArray();
        char[] y=t.toCharArray();
        int flag=0;
        for (int i=0;i<s.length() ;i++ ) 
        {
           if (fun(x,y,i)==1) 
           {
                flag=1;
                break;
           }
            else
                flag=0;
        }
        if(flag==1)
            System.out.println("Yes");
        else
            System.out.println("No");
        
    }
}