import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	}
	//true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	}

}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	}
	//true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc boolean flg = false; flg false Main main = new Main(); main new Main() for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		} int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		} {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		} if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			} S.equals(T) S.equals S T {
				flg = true;
				break;
			} flg = true flg true break; {
				S = main.rotateString(S, true);
			} S = main.rotateString(S, true) S main.rotateString(S, true) main.rotateString main S true if (flg) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} flg {
			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 //true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	} rotateString {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	} if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		} s.length() == 0 s.length() s.length s 0 {
			return s;
		} return s; s {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		} if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			} direction {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			} s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1) s s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1) s.substring(s.length()-1, s.length()) s.substring s s.length()-1 s.length() s.length s 1 s.length() s.length s s.substring(0, s.length()-1) s.substring s 0 s.length()-1 s.length() s.length s 1 {
				s = s.substring(1) + s.substring(0, 1);
			} s = s.substring(1) + s.substring(0, 1) s s.substring(1) + s.substring(0, 1) s.substring(1) s.substring s 1 s.substring(0, 1) s.substring s 0 1 return s; s String s s boolean direction direction public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	}
	//true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	}
	//true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		boolean flg = false;
		Main main = new Main();
		for (int i = 0; i < T.length(); i++) {
			if (S.equals(T)) {
				flg = true;
				break;
			}else {
				S = main.rotateString(S, true);
			}
		}

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

	}
	//true=right false=left
	public String rotateString(String s,boolean direction) {
		if (s.length() == 0) {
			return s;
		}else {
			//右
			if (direction) {
				s = s.substring(s.length()-1, s.length()) + s.substring(0, s.length()-1);
			}else {
				s = s.substring(1) + s.substring(0, 1);
			}
			return s;
		}
	}

}

