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

class Ring{
	String str1;

	Ring(String str1){
		this.str1 = str1 + str1;
	}
}

class Keyword{
	String str2;

	Keyword(String str2){
		this.str2 = str2;
	}
}

public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java class Ring{
	String str1;

	Ring(String str1){
		this.str1 = str1 + str1;
	}
} Ring String str1; str1 Ring(String str1){
		this.str1 = str1 + str1;
	} Ring {
		this.str1 = str1 + str1;
	} this.str1 = str1 + str1 this.str1 this this.str1 str1 + str1 str1 str1 String str1 str1 class Keyword{
	String str2;

	Keyword(String str2){
		this.str2 = str2;
	}
} Keyword String str2; str2 Keyword(String str2){
		this.str2 = str2;
	} Keyword {
		this.str2 = str2;
	} this.str2 = str2 this.str2 this this.str2 str2 String str2 str2 public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
} Main public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	} main {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) Ring x = new Ring(br.readLine()); x new Ring(br.readLine()) Keyword y = new Keyword(br.readLine()); y new Keyword(br.readLine()) if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		} x.str1.contains(y.str2) x.str1.contains x.str1 x x.str1 y.str2 y y.str2 {
			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 public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
} public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
} Main
import java.io.*;
import java.util.*;

class Ring{
	String str1;

	Ring(String str1){
		this.str1 = str1 + str1;
	}
}

class Keyword{
	String str2;

	Keyword(String str2){
		this.str2 = str2;
	}
}

public class Main{
	public static void main(String[] args) throws IOException{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	Ring x = new Ring(br.readLine());
	Keyword y = new Keyword(br.readLine());

		if(x.str1.contains(y.str2)){
			System.out.println("Yes");
		}else{
			System.out.println("No");			
		}
	}
}