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();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	}

} 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();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		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 sc.close() sc.close sc for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		} {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		} if(S.equals(T)) {
				System.out.println("Yes");
				return;
			} S.equals(T) S.equals S T {
				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; String 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 = S.charAt(S.length() - 1) + tmp S S.charAt(S.length() - 1) + tmp S.charAt(S.length() - 1) S.charAt S S.length() - 1 S.length() S.length S 1 tmp System.out.println("No") System.out.println System.out System System.out "No" 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();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String T = sc.next();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	}

} 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();
		sc.close();

		for(int i = 0; i < S.length(); i++) {
			if(S.equals(T)) {
				System.out.println("Yes");
				return;
			}
			String tmp = S.substring(0, S.length() - 1);
			S = S.charAt(S.length() - 1) + tmp;
		}
		System.out.println("No");
	}

}
