

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();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		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.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	} main {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	} 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 String[] ss = S.split(""); ss S.split("") S.split S "" String[] tt = T.split(""); tt T.split("") T.split T "" for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		} int i = 0; int i = 0; i 0 i < ss.length i ss.length ss ss.length i++ i++ i {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		} {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		} String kaiten = ""; kaiten "" kaiten += tt[ss.length - 1] kaiten tt[ss.length - 1] tt ss.length - 1 ss.length ss ss.length 1 for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			} int j = 0; int j = 0; j 0 j <= ss.length - 2 j ss.length - 2 ss.length ss ss.length 2 j++ j++ j {
				kaiten += tt[j];
			} {
				kaiten += tt[j];
			} kaiten += tt[j] kaiten tt[j] tt j if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			} kaiten.equals(S) kaiten.equals kaiten S {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; tt = kaiten.split("") tt kaiten.split("") kaiten.split kaiten "" 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.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	}
} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		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.next();
		String T = sc.next();

		String[] ss = S.split("");
		String[] tt = T.split("");

		for (int i = 0; i < ss.length; i++) {
			String kaiten = "";
			kaiten += tt[ss.length - 1];
			for (int j = 0; j <= ss.length - 2; j++) {
				kaiten += tt[j];
			}
			if (kaiten.equals(S)) {
				System.out.println("Yes");
				return;
			}
			tt = kaiten.split("");
		}
		System.out.println("No");
	}
}
