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();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} 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();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	} 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 result = "No"; result "No" String s_turned = s; s_turned s for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		} {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		} char c1 = s_turned.charAt(0); c1 s_turned.charAt(0) s_turned.charAt s_turned 0 String s_temp = s_turned.substring(1); s_temp s_turned.substring(1) s_turned.substring s_turned 1 s_turned = s_temp + c1 s_turned s_temp + c1 s_temp c1 if (s_turned.equals(t)) {
				result = "Yes";
				break;
			} s_turned.equals(t) s_turned.equals s_turned t {
				result = "Yes";
				break;
			} result = "Yes" 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) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
} 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();
		// Sを1回転させる。Tと一致したらYesしてbreak
		String result = "No";
		String s_turned = s;
		for (int i = 0; i < s.length(); i++) {
			char c1 = s_turned.charAt(0);
			String s_temp = s_turned.substring(1);
			s_turned = s_temp + c1;
			if (s_turned.equals(t)) {
				result = "Yes";
				break;
			}
		}
		System.out.println(result);
	}
}