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

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() char[] s = br.readLine().toCharArray(); s br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br int point; point Boolean flag = false; flag false for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		} int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		} {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		} point = i point i for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			} int j = 0; int j = 0; j 0 j < p.length() j p.length() p.length p j++ j++ j {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			} {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			} if(point == s.length) {
					point = 0;
				} point == s.length point s.length s s.length {
					point = 0;
				} point = 0 point 0 sb.append(s[point]) sb.append sb s[point] s point point++ point if(sb.toString().equals(p)) {
				flag = true;
				break;
			} sb.toString().equals(p) sb.toString().equals sb.toString() sb.toString sb p {
				flag = true;
				break;
			} flag = true flag true break; sb.setLength(0) sb.setLength sb 0 if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} flag {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb = new StringBuilder();

		char[] s = br.readLine().toCharArray();
		String p = br.readLine();
		int point;
		Boolean flag = false;

		for(int i = 0; i < s.length; i++) {
			point = i;
			for(int j = 0; j < p.length(); j++) {
				if(point == s.length) {
					point = 0;
				}
				sb.append(s[point]);
				point++;
			}

			if(sb.toString().equals(p)) {
				flag = true;
				break;
			}
			sb.setLength(0);
		}

		if(flag) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}