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

public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		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) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
} Main public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	} main {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s = ""; s "" String p = ""; p "" try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} NumberFormatException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} IOException e {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			s = in.readLine();
			p = in.readLine();
		} s = in.readLine() s in.readLine() in.readLine in p = in.readLine() p in.readLine() in.readLine in boolean flag = false; flag false for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		} {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		} flag = true flag true for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			} int j = 0; int j = 0; j 0 j < p.length() j p.length() p.length p j++ j++ j {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			} {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			} int pointer = i + j; pointer i + j i j if (pointer >= s.length()) pointer = pointer - s.length(); pointer >= s.length() pointer s.length() s.length s pointer = pointer - s.length() pointer pointer - s.length() pointer s.length() s.length s if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				} s.charAt(pointer) != p.charAt(j) s.charAt(pointer) s.charAt s pointer p.charAt(j) p.charAt p j {
					flag = false;
					
					break;
				} flag = false flag false break; if (flag) break; flag break; if (flag) System.out.println("Yes");
		else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
} public class Main {
	public static void main(String[] args) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		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) {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		String s = "";
		String p = "";
		try {
			s = in.readLine();
			p = in.readLine();
		} catch (NumberFormatException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		boolean flag = false;
		for (int i = 0; i < s.length(); i++) {
			flag = true;
			for (int j = 0; j < p.length(); j++) {
				int pointer = i + j;
				if (pointer >= s.length()) pointer = pointer - s.length();

				if (s.charAt(pointer) != p.charAt(j)) {
					flag = false;
					
					break;
				}
			}
			if (flag) break;
		}
		if (flag) System.out.println("Yes");
		else System.out.println("No");
	}
}