import java.io.*;
public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    }
} import java.io.*; io.* java public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    } main {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String sln; sln String pln; pln String ans="No"; ans "No" int plen plen j; j sln=br.readLine() sln br.readLine() br.readLine br pln=br.readLine() pln br.readLine() br.readLine br plen=pln.length() plen pln.length() pln.length pln char s[]=(sln+sln.substring(0,plen-1)).toCharArray(); s (sln+sln.substring(0,plen-1)).toCharArray() (sln+sln.substring(0,plen-1)).toCharArray (sln+sln.substring(0,plen-1)) sln sln.substring(0,plen-1) sln.substring sln 0 plen-1 plen 1 char p[]=pln.toCharArray(); p pln.toCharArray() pln.toCharArray pln for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        } int i=0; int i=0; i 0 i<=s.length-plen i s.length-plen s.length s s.length plen i++ i++ i {
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        } {
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        } if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            } (s[i]==p[0])&&(s[i+plen-1]==p[plen-1]) (s[i]==p[0]) s[i] s i p[0] p 0 (s[i+plen-1]==p[plen-1]) s[i+plen-1] s i+plen-1 i+plen i plen 1 p[plen-1] p plen-1 plen 1 {
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            } if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             } plen==1 plen 1 {
	                    	ans="Yes" ;
	                    	break;
	             } ans="Yes" ans "Yes" break; for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                } j=1; j=1 j 1 j<plen-1 j plen-1 plen 1 j++ j++ j {
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                } {
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                } if(s[i+j]==p[j]){
                            continue;
                        }else break; s[i+j]==p[j] s[i+j] s i+j i j p[j] p j {
                            continue;
                        } continue; break; if(j==plen-1) ans="Yes"; j==plen-1 j plen-1 plen 1 ans="Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    }
} Main
import java.io.*;
public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String sln;
        String pln;
        String ans="No";
        int plen,j;
        sln=br.readLine();
        pln=br.readLine();
        plen=pln.length();
        char s[]=(sln+sln.substring(0,plen-1)).toCharArray();
        char p[]=pln.toCharArray();
         
        for(int i=0;i<=s.length-plen;i++){
            if((s[i]==p[0])&&(s[i+plen-1]==p[plen-1])){
                     if(plen==1){
	                    	ans="Yes" ;
	                    	break;
	             }
                   for(j=1;j<plen-1;j++){
                        if(s[i+j]==p[j]){
                            continue;
                        }else break;
                 
                }
                    if(j==plen-1) ans="Yes";
            }
        }
        System.out.println(ans);
    }
}