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();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
} 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();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();
		String t = sc.next();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();
		String t = sc.next();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	} 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 String s1 =""; s1 "" String ans ="No"; ans "No" int cnt = 0; cnt 0 while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		} cnt < s.length() cnt s.length() s.length s {
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		} if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			} s.equals(t) s.equals s t {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			} s1 = s.substring(0,1) s1 s.substring(0,1) s.substring s 0 1 s = s.substring(1) + s1 s s.substring(1) + s1 s.substring(1) s.substring s 1 s1 cnt++ cnt System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();
		String t = sc.next();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 入力
		String s = sc.next();
		String t = sc.next();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
} 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();

		String s1 ="";
		String ans ="No";
		int cnt = 0;

		while (cnt < s.length()){
			if (s.equals(t)) {
				ans = "Yes";
				break;
			} else {
				s1 = s.substring(0,1);
				s = s.substring(1) + s1;
			}
			cnt++;
		}
		// 出力
		System.out.println(ans);
	}
}