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

public class Main{
	public static void main(String[] args){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	}
} import java.util.*; util.* java import java.io.*; io.* java public class Main{
	public static void main(String[] args){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	}
} Main public static void main(String[] args){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	} main {

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	} Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	} catch(IOException e){
	
	} IOException e {
	
	} {
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	} String strS = input.readLine(); strS input.readLine() input.readLine input String strT = input.readLine(); strT input.readLine() input.readLine input char[] charArray = strS.toCharArray(); charArray strS.toCharArray() strS.toCharArray strS String ans = "No"; ans "No" for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	} int i = 0; int i = 0; i 0 i < charArray.length i charArray.length charArray charArray.length i++ i++ i {
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	} {
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	} char c = charArray[charArray.length - 1]; c charArray[charArray.length - 1] charArray charArray.length - 1 charArray.length charArray charArray.length 1 for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		} int j = charArray.length - 1; int j = charArray.length - 1; j charArray.length - 1 charArray.length charArray charArray.length 1 j > 0 j 0 j-- j-- j {
			charArray[j] = charArray[j - 1];
		} {
			charArray[j] = charArray[j - 1];
		} charArray[j] = charArray[j - 1] charArray[j] charArray j charArray[j - 1] charArray j - 1 j 1 charArray[0] = c charArray[0] charArray 0 c String str = String.valueOf(charArray); str String.valueOf(charArray) String.valueOf String charArray if(str.equals(strT)){
			ans = "Yes";
			break;
		} str.equals(strT) str.equals str strT {
			ans = "Yes";
			break;
		} ans = "Yes" ans "Yes" break; 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){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	}
} public class Main{
	public static void main(String[] args){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	}
} Main
import java.util.*;
import java.io.*;

public class Main{
	public static void main(String[] args){

	Scanner stdIn = new Scanner(System.in);
	BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
	try{
	String strS = input.readLine();
	String strT = input.readLine();

	char[] charArray = strS.toCharArray();
	String ans = "No";

	for(int i = 0;i < charArray.length;i++){
		char c = charArray[charArray.length - 1];

		for(int j = charArray.length - 1;j > 0;j--){
			charArray[j] = charArray[j - 1];
		}
		charArray[0] = c;
		String str = String.valueOf(charArray);

		if(str.equals(strT)){
			ans = "Yes";
			break;
		}
	}
	System.out.println(ans);
	}
	catch(IOException e){
	
	}
		



	}
}
