import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    }
} Main public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    } main {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    } try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        } {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line boolean t=false; t false while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            } (line = br.readLine()) != null (line = br.readLine()) line br.readLine() br.readLine br null {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            } String line2=br.readLine(); line2 br.readLine() br.readLine br line=line+line line line+line line line for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	} int i=0; int i=0; i 0 i<line.length()-line2.length() i line.length()-line2.length() line.length() line.length line line2.length() line2.length line2 i++ i++ i {
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	} {
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	} if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		} line.substring(i, i+line2.length()).equals(line2) line.substring(i, i+line2.length()).equals line.substring(i, i+line2.length()) line.substring line i i+line2.length() i line2.length() line2.length line2 line2 {
            			t=true;
            			break;
            		} t=true t true break; System.out.println(t?"Yes":"No") System.out.println System.out System System.out t?"Yes":"No" t "Yes" "No" break; String[] args args public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    }
} public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean t=false;
            while ((line = br.readLine()) != null) {
            	String line2=br.readLine();
            	line=line+line;
            	for(int i=0;i<line.length()-line2.length();i++){
            		if(line.substring(i, i+line2.length()).equals(line2)){
            			t=true;
            			break;
            		}
            	}
            	
            	System.out.println(t?"Yes":"No");
            	break;
            }
        }
    }
}