import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str1 = scan.next(); str1 scan.next() scan.next scan char[] box = str1.toCharArray(); box str1.toCharArray() str1.toCharArray str1 String str2 = scan.next(); str2 scan.next() scan.next scan char[] question = str2.toCharArray(); question str2.toCharArray() str2.toCharArray str2 int j; j int k; k boolean flg = false; flg false for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		} int i = 0; int i = 0; i 0 i < box.length i box.length box box.length i++ i++ i {
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		} {
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		} if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			} question[0] == box[i] question[0] question 0 box[i] box i {
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			} j = 1 j 1 k = i + 1 k i + 1 i 1 if(k >= box.length){k = 0;} k >= box.length k box.length box box.length {k = 0;} k = 0 k 0 while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				} j < question.length && question[j] == box[k] j < question.length j question.length question question.length question[j] == box[k] question[j] question j box[k] box k {	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				} j++ j k++ k if(k >= box.length){k = 0;} k >= box.length k box.length box box.length {k = 0;} k = 0 k 0 if(j == question.length)
				{
					flg = true;
				} j == question.length j question.length question question.length {
					flg = true;
				} flg = true flg true if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} flg == true flg true {
			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)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		String str1 = scan.next();
		char[] box = str1.toCharArray();
		String str2 = scan.next();
		char[] question = str2.toCharArray();
		int j;
		int k;
		boolean flg = false;
		
		for(int i = 0;i < box.length;i++)
		{
			if(question[0] == box[i])
			{
				j = 1;
				k = i + 1;
				if(k >= box.length){k = 0;}
				while(j < question.length && question[j] == box[k])
				{	
					j++;
					k++;
					
					if(k >= box.length){k = 0;}
				}
				if(j == question.length)
				{
					flg = true;
				}
			}
		}
		if(flg == true)
		{
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}