import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder S = new StringBuilder(sc.nextLine()); S new StringBuilder(sc.nextLine()) String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc boolean matched = false; matched false int length = S.length(); length S.length() S.length S for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		} int i = 0; int i = 0; i 0 i < length i length i++ i++ i {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		} {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		} if (S.toString().equals(T)) {
				matched = true;
				break;
			} S.toString().equals(T) S.toString().equals S.toString() S.toString S T {
				matched = true;
				break;
			} matched = true matched true break; char rotate = S.charAt(length - 1); rotate S.charAt(length - 1) S.charAt S length - 1 length 1 S.deleteCharAt(length - 1) S.deleteCharAt S length - 1 length 1 S.insert(0, rotate) S.insert S 0 rotate System.out.println(matched ? "Yes" : "No") System.out.println System.out System System.out matched ? "Yes" : "No" matched "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder S = new StringBuilder(sc.nextLine());
		String T = sc.nextLine();
		
		boolean matched = false;
		int length = S.length();
		for (int i = 0; i < length; i++) {
			if (S.toString().equals(T)) {
				matched = true;
				break;
			}
			char rotate = S.charAt(length - 1);
			S.deleteCharAt(length - 1);
			S.insert(0, rotate);
		}
		
		System.out.println(matched ? "Yes" : "No");
	}
}