import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		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().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		System.out.println("No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" String[] t = sc.next().split(""); t sc.next().split("") sc.next().split sc.next() sc.next sc "" for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		} int i = 0; int i = 0; i 0 i <s.length i s.length s s.length i++ i++ i {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		} {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		} boolean sameFlag = true; sameFlag true for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			} int j = 0; int j = 0; j 0 j < s.length j s.length s s.length j++ j++ j {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			} {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			} if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				} !s[j].equals(t[j]) s[j].equals(t[j]) s[j].equals s[j] s j t[j] t j {
					sameFlag = false;
					break;
				} sameFlag = false sameFlag false break; if(sameFlag) {
				System.out.println("Yes");
				return;
			} sameFlag {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; String taihi = s[s.length-1]; taihi s[s.length-1] s s.length-1 s.length s s.length 1 for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			} int k =s.length-1; int k =s.length-1; k s.length-1 s.length s s.length 1 k >0 k 0 k-- k-- k {
				s[k] = s[k-1];
			} {
				s[k] = s[k-1];
			} s[k] = s[k-1] s[k] s k s[k-1] s k-1 k 1 s[0] = taihi s[0] s 0 taihi 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().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		System.out.println("No");
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String[] s = sc.next().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		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().split("");
		String[] t = sc.next().split("");
		for(int i = 0;i <s.length;i++) {
			boolean sameFlag = true;
			for(int j = 0;j < s.length;j++) {
				if(!s[j].equals(t[j])) {
					sameFlag = false;
					break;
				}
			}
			if(sameFlag) {
				System.out.println("Yes");
				return;
			}
			String taihi = s[s.length-1];
			for(int k =s.length-1; k >0 ;k--) {
				s[k] = s[k-1];
			}
			s[0] = taihi;
		}
		System.out.println("No");
	}
}