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

class Main {
	public static void main(String[] args) throws IOException{
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {
	public static void main(String[] args) throws IOException{
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    }
} Main public static void main(String[] args) throws IOException{
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    } main {
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    } String s s p p temp; temp boolean match = false; match false BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) s = br.readLine() s br.readLine() br.readLine br p = br.readLine() p br.readLine() br.readLine br br.close() br.close br s = s + s s s + s s s for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	} int i = 0; int i = 0; i 0 i < s.length()/2 i s.length()/2 s.length() s.length s 2 i++ i++ i {
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	} {
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	} temp = s.substring(i, i + p.length()) temp s.substring(i, i + p.length()) s.substring s i i + p.length() i p.length() p.length p if(temp.equals(p)){
    			match = true;
    		} temp.equals(p) temp.equals temp p {
    			match = true;
    		} match = true match true if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	} match {
    		System.out.println("Yes");
    	} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
    		System.out.println("No");
    	} System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {
	public static void main(String[] args) throws IOException{
		String s,p,temp;
		boolean match = false;
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	s = br.readLine();
    	p = br.readLine();
    	br.close();

    	s = s + s;
    	for(int i = 0;i < s.length()/2;i++){
    		temp = s.substring(i, i + p.length());
    		if(temp.equals(p)){
    			match = true;
    		}
    	}
    	if(match){
    		System.out.println("Yes");
    	}
    	else{
    		System.out.println("No");
    	}
    }
}