import java.util.Scanner;
import java.util.Arrays;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			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 sArray [] = s.split(""); sArray s.split("") s.split s "" String t = sc.next(); t sc.next() sc.next sc String tArray [] = t.split(""); tArray t.split("") t.split t "" String a = ""; a "" boolean judge = false; judge false for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		} int k = 0; int k = 0; k 0 k < sArray.length k sArray.length sArray sArray.length k++ k++ k {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		} {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		} a = sArray[sArray.length - 1] a sArray[sArray.length - 1] sArray sArray.length - 1 sArray.length sArray sArray.length 1 for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			} int i = sArray.length - 1; int i = sArray.length - 1; i sArray.length - 1 sArray.length sArray sArray.length 1 i > 0 i 0 i-- i-- i {
				sArray[i] = sArray[i - 1];
			} {
				sArray[i] = sArray[i - 1];
			} sArray[i] = sArray[i - 1] sArray[i] sArray i sArray[i - 1] sArray i - 1 i 1 sArray[0] = a sArray[0] sArray 0 a if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			} Arrays.equals(sArray, tArray) Arrays.equals Arrays sArray tArray {
				judge = true;
				break;
			} judge = true judge true break; if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} judge {
			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" 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 sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			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 sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
} Main
import java.util.Scanner;
import java.util.Arrays;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sArray [] = s.split("");
		String t = sc.next();
		String tArray [] = t.split("");
		String a = "";
		boolean judge = false;
		for(int k = 0; k < sArray.length; k++) {
			a = sArray[sArray.length - 1];
			for(int i = sArray.length - 1; i > 0; i--){
				sArray[i] = sArray[i - 1];
			}
			sArray[0] = a;
			if(Arrays.equals(sArray, tArray)) {
				judge = true;
				break;
			}
		}
		if(judge) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		sc.close();
	}
}
