import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    }
}
 import java.io.OutputStream; OutputStream java.io import java.io.IOException; IOException java.io import java.io.InputStream; InputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util import java.util.Deque; Deque java.util import java.util.ArrayDeque; ArrayDeque java.util public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    }
} Main public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    } main {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    } InputStream inputStream = System.in; inputStream System.in System System.in OutputStream outputStream = System.out; outputStream System.out System System.out Scanner in = new Scanner(inputStream); in new Scanner(inputStream) PrintWriter out = new PrintWriter(outputStream); out new PrintWriter(outputStream) B solver = new B(); solver new B() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    } B public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        } solve {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        } String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in Deque<Character> q = new ArrayDeque<>(); q new ArrayDeque<>() if (S.equals(T)) {
                out.println("Yes");
                return;
            } S.equals(T) S.equals S T {
                out.println("Yes");
                return;
            } out.println("Yes") out.println out "Yes" return; for (int i = 0; i < S.length(); i++) {
                q.offerLast(S.charAt(i));
            } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
                q.offerLast(S.charAt(i));
            } {
                q.offerLast(S.charAt(i));
            } q.offerLast(S.charAt(i)) q.offerLast q S.charAt(i) S.charAt S i for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            } {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            } String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1); s1 q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1) q.toString().replaceAll("[, ]", "").substring q.toString().replaceAll("[, ]", "") q.toString().replaceAll q.toString() q.toString q "[, ]" "" 1 S.length() + 1 S.length() S.length S 1 q.offerFirst(q.pollLast()) q.offerFirst q q.pollLast() q.pollLast q if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                } s1.equals(T) s1.equals s1 T {
                    out.println("Yes");
                    return;
                } out.println("Yes") out.println out "Yes" return; out.println("No") out.println out "No" int testNumber testNumber Scanner in in PrintWriter out out public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    }
} public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    }
} Main
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.Deque;
import java.util.ArrayDeque;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            String S = in.next();
            String T = in.next();
            Deque<Character> q = new ArrayDeque<>();

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

            for (int i = 0; i < S.length(); i++) {
                String s1 = q.toString().replaceAll("[, ]", "").substring(1, S.length() + 1);
//            out.println(s1);
                q.offerFirst(q.pollLast());
                if (s1.equals(T)) {
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }

    }
}

