import java.util.Arrays;
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();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

} import java.util.Arrays; Arrays java.util 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();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	} 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 int ns = s.length(); ns s.length() s.length s int nt = t.length(); nt t.length() t.length t sc.close() sc.close sc String ans[] = { "Yes", "No" }; ans { "Yes", "No" } "Yes" "No" int a = 0; a 0 if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		} nt != ns nt ns a = 1 a 1 {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		} if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			} !s.equals(t) s.equals(t) s.equals s t {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			} String tmp = s; tmp s for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				} int i = 0; int i = 0; i 0 i < ns i ns ++i ++i i {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				} {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				} tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1) tmp tmp.substring(ns - 1) + tmp.substring(0, ns - 1) tmp.substring(ns - 1) tmp.substring tmp ns - 1 ns 1 tmp.substring(0, ns - 1) tmp.substring tmp 0 ns - 1 ns 1 if(tmp.equals(t))break; tmp.equals(t) tmp.equals tmp t break; if(tmp.equals(s))a = 1; tmp.equals(s) tmp.equals tmp s a = 1 a 1 System.out.println(ans[a]) System.out.println System.out System System.out ans[a] ans a 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();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

} Main
import java.util.Arrays;
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();
		int ns = s.length();
		int nt = t.length();
		sc.close();
		String ans[] = { "Yes", "No" };
		int a = 0;
		if (nt != ns)
			a = 1;
		else {
			if (!s.equals(t)) {
				String tmp = s;
				for (int i = 0; i < ns; ++i) {
					tmp = tmp.substring(ns - 1) + tmp.substring(0, ns - 1);
					if(tmp.equals(t))break;
				}
				if(tmp.equals(s))a = 1;
			}
		}
		System.out.println(ans[a]);
	}

}
