import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		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 s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		System.out.println("No");
	}
} Main public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		System.out.println("No");
	} main {
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		System.out.println("No");
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine() s scan.nextLine() scan.nextLine scan t = scan.nextLine(); t scan.nextLine() scan.nextLine scan int len = s.length(); len s.length() s.length s scan.close() scan.close scan for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		} int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		} {
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		} if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			} s.equals(t) s.equals s t {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; s = s.charAt(len - 1) + s.substring(0, len - 1) s s.charAt(len - 1) + s.substring(0, len - 1) s.charAt(len - 1) s.charAt s len - 1 len 1 s.substring(0, len - 1) s.substring s 0 len - 1 len 1 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 s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		System.out.println("No");
	}
} public class Main
{
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		
		String s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		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 s = scan.nextLine(), t = scan.nextLine();
		int len = s.length();
		scan.close();
		
		for (int i = 0; i < len; i++)
		{
			if (s.equals(t))
			{
				System.out.println("Yes");
				return;
			}
			s = s.charAt(len - 1) + s.substring(0, len - 1);
		}
		
		System.out.println("No");
	}
}

