import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	}
} 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 t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		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 t = sc.nextLine(); t sc.nextLine() sc.nextLine sc char c[] = s.toCharArray(); c s.toCharArray() s.toCharArray s boolean ans = false; ans false for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		} int i = 0; int i = 0; i 0 i <= s.length() + 3 i s.length() + 3 s.length() s.length s 3 i++ i++ i {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		} {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		} turn(c) turn c s = new String(c) s new String(c) if (s.equals(t)) {
				ans = true;
			} s.equals(t) s.equals s t {
				ans = true;
			} ans = true ans true 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 static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	} turn {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	} char ten = c[c.length - 1]; ten c[c.length - 1] c c.length - 1 c.length c c.length 1 for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		} int i = c.length - 1; int i = c.length - 1; i c.length - 1 c.length c c.length 1 i > 0 i 0 i-- i-- i {
			c[i] = c[i - 1];
		} {
			c[i] = c[i - 1];
		} c[i] = c[i - 1] c[i] c i c[i - 1] c i - 1 i 1 c[0] = ten c[0] c 0 ten char c[] c public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	}
} 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 t = sc.nextLine();
		char c[] = s.toCharArray();
		boolean ans = false;
		for (int i = 0; i <= s.length() + 3; i++) {
			turn(c);
			s = new String(c);

			if (s.equals(t)) {
				ans = true;
			}
		}
		if (ans) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	public static void turn(char c[]) {
		char ten = c[c.length - 1];
		for (int i = c.length - 1; i > 0; i--) {
			c[i] = c[i - 1];
		}
		c[0] = ten;

	}
}