import java.util.Scanner;

public class Main {

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

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

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	} main {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	} 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 flag = false; flag false for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		} {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		} flag = s.equals(t) flag s.equals(t) s.equals s t if (flag)
				break; flag break; char e; e String tmp; tmp e = s.charAt(s.length() - 1) e s.charAt(s.length() - 1) s.charAt s s.length() - 1 s.length() s.length s 1 tmp = s.substring(0, s.length() - 1) tmp s.substring(0, s.length() - 1) s.substring s 0 s.length() - 1 s.length() s.length s 1 s = e + tmp s e + tmp e tmp 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" sc.close() sc.close sc String[] args args public class Main {

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

} public class Main {

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

} Main
import java.util.Scanner;

public class Main {

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

		Scanner sc = new Scanner(System.in);

		String s = sc.next();
		String t = sc.next();
		boolean flag = false;

		for (int i = 0; i < s.length(); i++) {

			flag = s.equals(t);
			if (flag)
				break;

			char e;
			String tmp;
			e = s.charAt(s.length() - 1);
			tmp = s.substring(0, s.length() - 1);
			s = e + tmp;

		}

		if (flag)
			System.out.println("Yes");
		else
			System.out.println("No");
		sc.close();
	}

}
