import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

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

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

} Main public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) final String s = sc.next(); s sc.next() sc.next sc final String t = sc.next(); t sc.next() sc.next sc final int sLength = s.length(); sLength s.length() s.length s String result = "No"; result "No" String s2 = s; s2 s for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < sLength i sLength i++ i++ i {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		} {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		} final String last = s2.substring(sLength - 1, sLength); last s2.substring(sLength - 1, sLength) s2.substring s2 sLength - 1 sLength 1 sLength String tmps = s2.substring(0, sLength - 1); tmps s2.substring(0, sLength - 1) s2.substring s2 0 sLength - 1 sLength 1 s2 = last + tmps s2 last + tmps last tmps if (s2.equals(t)) {
				result = "Yes";
				break;
			} s2.equals(t) s2.equals s2 t {
				result = "Yes";
				break;
			} result = "Yes" result "Yes" break; java.lang.System.out.println(result) java.lang.System.out.println java.lang.System.out java.lang.System java.lang java java.lang java.lang.System java.lang.System.out result String[] args args public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

} public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		final String s = sc.next();
		final String t = sc.next();

		final int sLength = s.length();

		String result = "No";
		String s2 = s;
		for (int i = 0; i < sLength; i++) {
			final String last = s2.substring(sLength - 1, sLength);
			String tmps = s2.substring(0, sLength - 1);
			s2 = last + tmps;
			if (s2.equals(t)) {
				result = "Yes";
				break;
			}
		}

		java.lang.System.out.println(result);

	}

}
