
import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	}
} import java.util.Iterator; Iterator java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	} main {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s1 = scan.next(); s1 scan.next() scan.next scan String s2 = scan.next(); s2 scan.next() scan.next scan String ans = "No"; ans "No" char[] list = new char[s1.length()]; list new char[s1.length()] s1.length() s1.length s1 for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		} int i = 0; int i = 0; i 0 i < s1.length() i s1.length() s1.length s1 i++ i++ i {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		} {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		} for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			} int j = 0; int j = 0; j 0 j < s1.length() j s1.length() s1.length s1 j++ j++ j {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			} {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			} if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				} j == 0 j 0 {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				} list[0] = s1.charAt(s1.length() - 1) list[0] list 0 s1.charAt(s1.length() - 1) s1.charAt s1 s1.length() - 1 s1.length() s1.length s1 1 continue; list[j] = s1.charAt(j - 1) list[j] list j s1.charAt(j - 1) s1.charAt s1 j - 1 j 1 StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			} int j = 0; int j = 0; j 0 j < list.length j list.length list list.length j++ j++ j {
				sb.append(String.valueOf(list[j]));
			} {
				sb.append(String.valueOf(list[j]));
			} sb.append(String.valueOf(list[j])) sb.append sb String.valueOf(list[j]) String.valueOf String list[j] list j s1 = sb.toString() s1 sb.toString() sb.toString sb if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			} s1.equals(s2) s1.equals s1 s2 {
				ans = "Yes";
				break;
				
			} ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	}
} Main

import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		String s2 = scan.next();
		
		String ans = "No";
		char[] list = new char[s1.length()];
		for (int i = 0; i < s1.length(); i++) {
			for (int j = 0; j < s1.length(); j++) {
				if (j == 0) {
					list[0] = s1.charAt(s1.length() - 1);
					continue;
				}
				list[j] = s1.charAt(j - 1);
			}
			StringBuilder sb = new StringBuilder();
			for (int j = 0; j < list.length; j++) {
				sb.append(String.valueOf(list[j]));
			}
			s1 = sb.toString();
			if (s1.equals(s2)) {
				ans = "Yes";
				break;
				
			}
		}
		System.out.println(ans);
	}
}