import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    }


} import java.io.BufferedReader; BufferedReader java.io import java.io.BufferedWriter; BufferedWriter java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.OutputStreamWriter; OutputStreamWriter java.io import java.io.IOException; IOException java.io public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    }


} Main public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) char[] input = br.readLine().toCharArray(); input br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char[] st = br.readLine().toCharArray(); st br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br int size = input.length; size input.length input input.length int size2 = st.length; size2 st.length st st.length boolean answer = false; answer false for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < size i size i++ i++ i {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        } {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        } boolean chk = true; chk true int j = 0; j 0 int k = i; k i while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            } j < size2 && k < size j < size2 j size2 k < size k size {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            } if (st[j] != input[k]) {
                    chk = false;
                    break;
                } st[j] != input[k] st[j] st j input[k] input k {
                    chk = false;
                    break;
                } chk = false chk false break; if (++k == size) k %= size; ++k == size ++k k size k %= size k size j++ j if (chk) {
                answer = true;
                break;
            } chk {
                answer = true;
                break;
            } answer = true answer true break; bw.append(answer ? "Yes\n" : "No\n") bw.append bw answer ? "Yes\n" : "No\n" answer "Yes\n" "No\n" bw.flush() bw.flush bw String args[] args public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    }


} public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    }


} Main
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.IOException;

public class Main {

    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        char[] input = br.readLine().toCharArray();
        char[] st = br.readLine().toCharArray();
        int size = input.length;
        int size2 = st.length;
        boolean answer = false;
        for (int i = 0; i < size; i++) {
            boolean chk = true;
            int j = 0;
            int k = i;
            while (j < size2 && k < size) {
                if (st[j] != input[k]) {
                    chk = false;
                    break;
                }
                if (++k == size) k %= size;
                j++;
            }
            if (chk) {
                answer = true;
                break;
            }
        }

        bw.append(answer ? "Yes\n" : "No\n");
        bw.flush();
    }


}
