
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }
    static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    }

    static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    }
    static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    }
    static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    }
    static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    }
    static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    }
    static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }
    static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }
    static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }
    static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    }

    static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    }
    static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    }
    static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    }
    static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    }
    static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    }
    static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }
    static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }
    static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }
} Main public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    } main {
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    } PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Task task = new Task(); task new Task() task.solve(sc, out) task.solve task sc out out.flush() out.flush out sc.close() sc.close sc String[] args args static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    } nint {
        return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc Scanner sc sc static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    } nlong {
        return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc Scanner sc sc static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    } ndouble {
        return Double.parseDouble(sc.next());
    } return Double.parseDouble(sc.next()); Double.parseDouble(sc.next()) Double.parseDouble Double sc.next() sc.next sc Scanner sc sc static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    } nfloat {
        return Float.parseFloat(sc.next());
    } return Float.parseFloat(sc.next()); Float.parseFloat(sc.next()) Float.parseFloat Float sc.next() sc.next sc Scanner sc sc static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    } nstr {
        return  String.valueOf(sc.next());
    } return  String.valueOf(sc.next()); String.valueOf(sc.next()) String.valueOf String sc.next() sc.next sc Scanner sc sc static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    } longLine {
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    } long[] lLine = new long[size]; lLine new long[size] size for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            lLine[i] = nlong(sc);
        } {
            lLine[i] = nlong(sc);
        } lLine[i] = nlong(sc) lLine[i] lLine i nlong(sc) nlong sc return lLine; lLine Scanner sc sc int size size static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    } intLine {
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    } int[] iLine = new int[size]; iLine new int[size] size for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            iLine[i] = nint(sc);
        } {
            iLine[i] = nint(sc);
        } iLine[i] = nint(sc) iLine[i] iLine i nint(sc) nint sc return iLine; iLine Scanner sc sc int size size static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    } strLine {
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    } String[] strLine = new String[size]; strLine new String[size] size for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            strLine[i] = nstr(sc);
        } {
            strLine[i] = nstr(sc);
        } strLine[i] = nstr(sc) strLine[i] strLine i nstr(sc) nstr sc return strLine; strLine Scanner sc sc int size size static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    } Task public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        } solve {
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        } String S = nstr(sc); S nstr(sc) nstr sc String T = nstr(sc); T nstr(sc) nstr sc List<String> SList = new ArrayList<>(); SList new ArrayList<>() for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            } {
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            } String x = String.valueOf(S.charAt(i)); x String.valueOf(S.charAt(i)) String.valueOf String S.charAt(i) S.charAt S i SList.add(x) SList.add SList x List<String> TList = new ArrayList<>(); TList new ArrayList<>() for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            } {
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            } String x = String.valueOf(T.charAt(i)); x String.valueOf(T.charAt(i)) String.valueOf String T.charAt(i) T.charAt T i TList.add(x) TList.add TList x for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            } int i=0; int i=0; i 0 i<SList.size() i SList.size() SList.size SList i++ i++ i {
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            } {
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            } String tmp = SList.get(SList.size()-1); tmp SList.get(SList.size()-1) SList.get SList SList.size()-1 SList.size() SList.size SList 1 SList.remove(SList.size()-1) SList.remove SList SList.size()-1 SList.size() SList.size SList 1 SList.add(0, tmp) SList.add SList 0 tmp if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                } SList.equals(TList) SList.equals SList TList {
                    out.println("Yes");
                    return;
                } out.println("Yes") out.println out "Yes" return; out.println("No") out.println out "No" Scanner sc sc PrintWriter out out public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }
    static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    }

    static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    }
    static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    }
    static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    }
    static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    }
    static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    }
    static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }
    static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }
    static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }
} public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }
    static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    }

    static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    }
    static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    }
    static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    }
    static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    }
    static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    }
    static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }
    static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }
    static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }
} Main

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        PrintWriter out = new PrintWriter(System.out);
        Scanner sc = new Scanner(System.in);
        Task task = new Task();
        task.solve(sc, out);
        out.flush();
        sc.close();
    }
    static class Task{
        public void solve(Scanner sc, PrintWriter out){
            String S = nstr(sc);
            String T = nstr(sc);
            List<String> SList = new ArrayList<>();

            for(int i = 0; i < S.length(); i++){
                String x = String.valueOf(S.charAt(i));
                SList.add(x);
            }
            List<String> TList = new ArrayList<>();
            for(int i = 0; i < T.length(); i++){
                String x = String.valueOf(T.charAt(i));
                TList.add(x);
            }

            for (int i=0; i<SList.size(); i++){
                String tmp = SList.get(SList.size()-1);
                SList.remove(SList.size()-1);
                SList.add(0, tmp);
                if (SList.equals(TList)){
                    out.println("Yes");
                    return;
                }
            }
            out.println("No");

        }
    }

    static int nint(Scanner sc){
        return Integer.parseInt(sc.next());
    }
    static long nlong(Scanner sc){
        return Long.parseLong(sc.next());
    }
    static double ndouble(Scanner sc){
        return Double.parseDouble(sc.next());
    }
    static float nfloat(Scanner sc){
        return Float.parseFloat(sc.next());
    }
    static String nstr(Scanner sc){
        return  String.valueOf(sc.next());
    }
    static long[] longLine(Scanner sc, int size){
        long[] lLine = new long[size];
        for (int i = 0; i < size; i++) {
            lLine[i] = nlong(sc);
        }
        return lLine;
    }
    static int[] intLine(Scanner sc, int size){
        int[] iLine = new int[size];
        for (int i = 0; i < size; i++) {
            iLine[i] = nint(sc);
        }
        return iLine;
    }
    static String[] strLine(Scanner sc, int size){
        String[] strLine = new String[size];
        for (int i = 0; i < size; i++) {
            strLine[i] = nstr(sc);
        }
        return strLine;
    }
}