import java.util.Scanner;

public class Main 
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			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 sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

} Main public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String f = sc.nextLine(); f sc.nextLine() sc.nextLine sc boolean ans = false; ans false for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		} {
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		} if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			} i <= s.length() - f.length() i s.length() - f.length() s.length() s.length s f.length() f.length f {
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			} if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				} s.substring(i, i+f.length()).equals(f) s.substring(i, i+f.length()).equals s.substring(i, i+f.length()) s.substring s i i+f.length() i f.length() f.length f f {
					ans = true;
					break;
				} ans = true ans true break; {
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			} int l1 = s.length() - i; l1 s.length() - i s.length() s.length s i int l = f.length() - l1; l f.length() - l1 f.length() f.length f l1 String comp = s.substring(i) + s.substring(0, l); comp s.substring(i) + s.substring(0, l) s.substring(i) s.substring s i s.substring(0, l) s.substring s 0 l if(comp.equals(f))
				{
					ans = true;
					break;
				} comp.equals(f) comp.equals comp f {
					ans = true;
					break;
				} ans = true ans true break; if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		} ans {
			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 sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

} public class Main 
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

} Main
import java.util.Scanner;

public class Main 
{
	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String f = sc.nextLine();
		boolean ans = false;

		for(int i = 0; i < s.length(); i++)
		{
			if(i <= s.length() - f.length())
			{
				if(s.substring(i, i+f.length()).equals(f))
				{
					ans = true;
					break;
				}
			}
			else
			{
				int l1 = s.length() - i;
				int l = f.length() - l1;
				String comp = s.substring(i) + s.substring(0, l);
				
				if(comp.equals(f))
				{
					ans = true;
					break;
				}
			}
		}
		
		if(ans)
		{
			System.out.println("Yes");
		}
		else
		{
			System.out.println("No");
		}
	}

}

