import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		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 T = sc.next(); T sc.next() sc.next sc if (S.equals(T)) {
			System.out.println("Yes");
			return;
		} S.equals(T) S.equals S T {
			System.out.println("Yes");
			return;
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; StringBuilder sb = new StringBuilder(S); sb new StringBuilder(S) for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < sb.length() - 1 i sb.length() - 1 sb.length() sb.length sb 1 i++ i++ i {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		} {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		} sb.insert(0, sb.charAt(sb.length() - 1)) sb.insert sb 0 sb.charAt(sb.length() - 1) sb.charAt sb sb.length() - 1 sb.length() sb.length sb 1 sb.delete(sb.length() - 1, sb.length()) sb.delete sb sb.length() - 1 sb.length() sb.length sb 1 sb.length() sb.length sb if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			} sb.toString().equals(T) sb.toString().equals sb.toString() sb.toString sb T {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
} public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		if (S.equals(T)) {
			System.out.println("Yes");
			return;
		}
		StringBuilder sb = new StringBuilder(S);
		for (int i = 0; i < sb.length() - 1; i++) {
			sb.insert(0, sb.charAt(sb.length() - 1));
			sb.delete(sb.length() - 1, sb.length());
			if (sb.toString().equals(T)) {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
		sc.close();
	}
}