import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	}	
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	}	
} Main public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready()); br.ready() br.ready br {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} String circleStr = br.readLine(); circleStr br.readLine() br.readLine br String answer = br.readLine(); answer br.readLine() br.readLine br int circleLen = circleStr.length(); circleLen circleStr.length() circleStr.length circleStr int answerLen = answer.length(); answerLen answer.length() answer.length answer String result = "No"; result "No" for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			} int i = 0; int i = 0; i 0 i < circleLen i circleLen i++ i++ i {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			} {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			} char c = circleStr.charAt(i); c circleStr.charAt(i) circleStr.charAt circleStr i int cIndex = i; cIndex i for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					} int j = 0; int j = 0; j 0 j < answerLen j answerLen j++ j++ j {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					} {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					} if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				} c == answer.charAt(j) c answer.charAt(j) answer.charAt answer j {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} if (answerLen - 1 == j) {
							result = "Yes";
							break;
						} answerLen - 1 == j answerLen - 1 answerLen 1 j {
							result = "Yes";
							break;
						} result = "Yes" result "Yes" break; if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						} circleLen - 1 == cIndex circleLen - 1 circleLen 1 cIndex {
							cIndex = 0;
						} cIndex = 0 cIndex 0 {
							cIndex++;
						} cIndex++ cIndex c = circleStr.charAt(cIndex) c circleStr.charAt(cIndex) circleStr.charAt circleStr cIndex {
						break;
				} break; if (result.equals("Yes")) break; result.equals("Yes") result.equals result "Yes" break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	}	
} public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	}	
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		do {
			String circleStr = br.readLine();
			String answer = br.readLine();
			int circleLen = circleStr.length();
			int answerLen = answer.length();
			String result = "No";
			for (int i = 0; i < circleLen; i++) {
				char c = circleStr.charAt(i);
				int cIndex = i;
				for (int j = 0; j < answerLen; j++) {
					if (c == answer.charAt(j)) {
						if (answerLen - 1 == j) {
							result = "Yes";
							break;
						}
						if (circleLen - 1 == cIndex) {
							cIndex = 0;
						} else {
							cIndex++;
						}
						c = circleStr.charAt(cIndex);
					} else {
						break;
				}
					}
				if (result.equals("Yes")) break;
			}
			System.out.println(result);
		} while (br.ready());
	}	
}