import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "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.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc String U = T; U T int count = 0; count 0 boolean flag = false; flag false for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        } {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        } for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            } int j = 0; int j = 0; j 0 j < S.length() j S.length() S.length S j++ j++ j {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            } {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            } if (S.charAt(j) == U.charAt(j)) {
                    count++;
                } S.charAt(j) == U.charAt(j) S.charAt(j) S.charAt S j U.charAt(j) U.charAt U j {
                    count++;
                } count++ count if (count == S.length()) {
                flag = true;
                break;
            } count == S.length() count S.length() S.length S {
                flag = true;
                break;
            } flag = true flag true break; count = 0 count 0 U = U.substring(1) + U.charAt(0) U U.substring(1) + U.charAt(0) U.substring(1) U.substring U 1 U.charAt(0) U.charAt U 0 System.out.println(flag ? "Yes" : "No") System.out.println System.out System System.out flag ? "Yes" : "No" flag "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.nextLine();
        String T = sc.nextLine();
        String U = T;
        int count = 0;
        boolean flag = false;
        for (int i = 0; i < S.length(); i++) {
            for (int j = 0; j < S.length(); j++) {
                if (S.charAt(j) == U.charAt(j)) {
                    count++;
                }
            }
            if (count == S.length()) {
                flag = true;
                break;
            }
            count = 0;
            U = U.substring(1) + U.charAt(0);
        }
        System.out.println(flag ? "Yes" : "No");
    }
}