import java.util.Scanner;

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

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            String T = in.next();

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    }

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

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    } main {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            String T = in.next();

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    } try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            String T = in.next();

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        } {
            String S = in.next();
            String T = in.next();

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in int n = S.length(); n S.length() S.length S for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            } int i = 0; int i = 0; i 0 i <= n i n i++ i++ i {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            } {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            } 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; S = S.substring(n - 1, n) + S.substring(0, n - 1) S S.substring(n - 1, n) + S.substring(0, n - 1) S.substring(n - 1, n) S.substring S n - 1 n 1 n S.substring(0, n - 1) S.substring S 0 n - 1 n 1 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[]) {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            String T = in.next();

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    }

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

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    }

} Main
import java.util.Scanner;

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

            int n = S.length();
            for (int i = 0; i <= n; i++) {
                if (S.equals(T)) {
                    System.out.println("Yes");
                    return;
                }

                S = S.substring(n - 1, n) + S.substring(0, n - 1);
            }

            System.out.println("No");
        }
    }

}
