import java.util.*;
public class Main {

	String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	}

} import java.util.*; util.* java public class Main {

	String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	}

} Main String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	} rotated {
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	} String beg = s.substring(0, i); beg s.substring(0, i) s.substring s 0 i String end = s.substring( i , length); end s.substring( i , length) s.substring s i length String last = end+ beg; last end+ beg end beg return last; last String s s int i i int length length public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	} main {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) Main one = new Main(); one new Main() String a a b; b a = scan.next() a scan.next() scan.next scan b= scan.next() b scan.next() scan.next scan int alength = a.length(); alength a.length() a.length a boolean found = false; found false for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			} int i=0; int i=0; i 0 i<alength i alength i++ i++ i {
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			} {
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			} if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				} a.charAt(i)==b.charAt(0) a.charAt(i) a.charAt a i b.charAt(0) b.charAt b 0 {
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				} String compare = one.rotated(a, i, alength); compare one.rotated(a, i, alength) one.rotated one a i alength if(compare.equals(b))
					{
						found = true;
						break;
					} compare.equals(b) compare.equals compare b {
						found = true;
						break;
					} found = true found true break; if(found)
			System.out.println("Yes");
		else
			System.out.println("No"); found System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" scan.close() scan.close scan String[] args args public class Main {

	String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	}

} public class Main {

	String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	}

} Main
import java.util.*;
public class Main {

	String rotated(String s, int i , int length)
	{
	String beg = s.substring(0, i);
	String end = s.substring( i , length);
	String last = end+ beg;
	return last;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		Main one = new Main();
		String a, b;
		a = scan.next();
		b= scan.next();
		int alength = a.length();
//		System.out.println(one.rotated(a, alength-1, alength));
		boolean found = false;
		for( int i=0; i<alength ;i++)
			{
				if(a.charAt(i)==b.charAt(0))
				{
					String compare = one.rotated(a, i, alength);
					if(compare.equals(b))
					{
						found = true;
						break;
					}
				}
			
			}
		if(found)
			System.out.println("Yes");
		else
			System.out.println("No");

	
		scan.close();
	}

}
