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[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			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[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			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[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		String[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			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[] sArr = s.split(""); sArr s.split("") s.split s "" boolean isOk = false; isOk false for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i < sArr.length i sArr.length sArr sArr.length i++ i++ i {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		} {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		} String rolled = ""; rolled "" for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			} int j = i; int j = i; j i j < sArr.length+i j sArr.length+i sArr.length sArr sArr.length i j++ j++ j {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			} {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			} if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				} j < sArr.length j sArr.length sArr sArr.length {
					rolled += sArr[j];
				} rolled += sArr[j] rolled sArr[j] sArr j {
					rolled += sArr[j - sArr.length];
				} rolled += sArr[j - sArr.length] rolled sArr[j - sArr.length] sArr j - sArr.length j sArr.length sArr sArr.length if (t.equals(rolled)) {
				isOk = true;
				break;
			} t.equals(rolled) t.equals t rolled {
				isOk = true;
				break;
			} isOk = true isOk true break; if (isOk) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} isOk {
			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 class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();

		String[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			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[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			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[] sArr = s.split("");
		boolean isOk = false;
		for (int i = 0; i < sArr.length; i++) {
			String rolled = "";
			for (int j = i; j < sArr.length+i; j++) {
				if (j < sArr.length) {
					rolled += sArr[j];
				} else {
					rolled += sArr[j - sArr.length];
				}

			}
			if (t.equals(rolled)) {
				isOk = true;
				break;
			}
		}

		if (isOk) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}
