import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    }
} import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    }
} Main public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    } main {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    } try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        } {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        } BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in)) new BufferedReader(
                new InputStreamReader(System.in)) StringBuilder S = new StringBuilder(reader.readLine()); S new StringBuilder(reader.readLine()) final String T = reader.readLine(); T reader.readLine() reader.readLine reader boolean flg = false; flg false for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            } {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            } if (T.contentEquals(S)) {
                    flg = true;
                    break;
                } T.contentEquals(S) T.contentEquals T S {
                    flg = true;
                    break;
                } flg = true flg true break; S = S.insert(0, S.charAt(S.length() - 1)) S S.insert(0, S.charAt(S.length() - 1)) S.insert S 0 S.charAt(S.length() - 1) S.charAt S S.length() - 1 S.length() S.length S 1 S.setLength(S.length() - 1) S.setLength S S.length() - 1 S.length() S.length S 1 System.out.println(flg ? "Yes" : "No") System.out.println System.out System System.out flg ? "Yes" : "No" flg "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    }
} Main
import java.io.IOException;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        try (
            BufferedReader reader = new BufferedReader(
                new InputStreamReader(System.in))) {
            StringBuilder S = new StringBuilder(reader.readLine());
            final String T = reader.readLine();

            boolean flg = false;
            for (int i = 0; i < S.length(); i++) {
                if (T.contentEquals(S)) {
                    flg = true;
                    break;
                }
                S = S.insert(0, S.charAt(S.length() - 1));
                S.setLength(S.length() - 1);
            }

            System.out.println(flg ? "Yes" : "No");
        }
    }
}
