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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
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);
        AtCoder109_2 solver = new AtCoder109_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    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 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);
        AtCoder109_2 solver = new AtCoder109_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    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);
        AtCoder109_2 solver = new AtCoder109_2();
        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);
        AtCoder109_2 solver = new AtCoder109_2();
        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) AtCoder109_2 solver = new AtCoder109_2(); solver new AtCoder109_2() solver.solve(1, in, out) solver.solve solver 1 in out out.close() out.close out String[] args args static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            }

            out.println("No");
        }

    } AtCoder109_2 public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            }

            out.println("No");
        } solve {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            }

            out.println("No");
        } String phrase = in.nextLine(); phrase in.nextLine() in.nextLine in String matcher = in.nextLine(); matcher in.nextLine() in.nextLine in if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            } phrase.compareTo(matcher) == 0 phrase.compareTo(matcher) phrase.compareTo phrase matcher 0 {
                out.println("Yes");
                return;
            } out.println("Yes") out.println out "Yes" return; for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            } int i = 1; int i = 1; i 1 i < phrase.length() i phrase.length() phrase.length phrase i++ i++ i {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            } {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            } String work1 = matcher.substring((matcher.length() - i)); work1 matcher.substring((matcher.length() - i)) matcher.substring matcher (matcher.length() - i) matcher.length() matcher.length matcher i String work2 = matcher.substring(0, (matcher.length() - i)); work2 matcher.substring(0, (matcher.length() - i)) matcher.substring matcher 0 (matcher.length() - i) matcher.length() matcher.length matcher i String work3 = work1 + work2; work3 work1 + work2 work1 work2 if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                } work3.compareTo(phrase) == 0 work3.compareTo(phrase) work3.compareTo work3 phrase 0 {
                    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);
        AtCoder109_2 solver = new AtCoder109_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    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);
        AtCoder109_2 solver = new AtCoder109_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    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;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author hakamada
 */
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);
        AtCoder109_2 solver = new AtCoder109_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class AtCoder109_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String phrase = in.nextLine();
            String matcher = in.nextLine();
            if (phrase.compareTo(matcher) == 0) {
                out.println("Yes");
                return;
            }


            for (int i = 1; i < phrase.length(); i++) {
                String work1 = matcher.substring((matcher.length() - i));
                String work2 = matcher.substring(0, (matcher.length() - i));
                String work3 = work1 + work2;
                if (work3.compareTo(phrase) == 0) {
                    out.println("Yes");
                    return;

                }
            }

            out.println("No");
        }

    }
}

