import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	}

} 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.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	}

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

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	} main {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc char[] c = s.toCharArray(); c s.toCharArray() s.toCharArray s for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		} int i = 0 ; int i = 0 ; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		} {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		} for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			} int j = 0 ; int j = 0 ; j 0 j< c.length j c.length c c.length j++ j++ j {
				c[j] = s.charAt((j + i) % c.length);
			} {
				c[j] = s.charAt((j + i) % c.length);
			} c[j] = s.charAt((j + i) % c.length) c[j] c j s.charAt((j + i) % c.length) s.charAt s (j + i) % c.length (j + i) j i c.length c c.length if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			} String.valueOf(c).equals(t) String.valueOf(c).equals String.valueOf(c) String.valueOf String c t {
				System.out.println("Yes");
				sc.close();
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" sc.close() sc.close sc return; System.out.println("No") System.out.println System.out System System.out "No" sc.close() sc.close sc String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		char[] c = s.toCharArray();
		for(int i = 0 ; i < s.length() ; i++) {
			for(int j = 0 ; j< c.length ; j++) {
				c[j] = s.charAt((j + i) % c.length);
			}
			if(String.valueOf(c).equals(t)) {
				System.out.println("Yes");
				sc.close();
				return;
			}
		}
		System.out.println("No");

		sc.close();

	}

}
