import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    }
} import java.io.*; io.* java class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    }
} Main public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char[] str = br.readLine().toCharArray(); str br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char[] target = br.readLine().toCharArray(); target br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br boolean answer = false; answer false int i i j; j System.out.println((answer) ? "Yes" : "No") System.out.println System.out System System.out (answer) ? "Yes" : "No" (answer) "Yes" "No" String[] args args
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    }
}