import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    }
} import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String s s p; p s = input.readLine() s input.readLine() input.readLine input if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        } s != null && s.length() > 0 && s.length() <= 100 s != null && s.length() > 0 && s.length() <= 100 s != null s null s.length() > 0 s.length() s.length s 0 s.length() <= 100 s.length() s.length s 100 {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        } p = input.readLine() p input.readLine() input.readLine input if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            } p != null && p.length() > 0 && p.length() <= s.length() p != null && p.length() > 0 && p.length() <= s.length() p != null p null p.length() > 0 p.length() p.length p 0 p.length() <= s.length() p.length() p.length p s.length() s.length s {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            } s += s.substring(0, s.length() - 1) s s.substring(0, s.length() - 1) s.substring s 0 s.length() - 1 s.length() s.length s 1 System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                ) System.out.println System.out System System.out s.indexOf(p) == -1? "No": "Yes" s.indexOf(p) == -1 s.indexOf(p) s.indexOf s p -1 1 "No" "Yes" String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    }
} Main
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String s, p;
        s = input.readLine();
        if (s != null && s.length() > 0 && s.length() <= 100) {
            p = input.readLine();
            if (p != null && p.length() > 0 && p.length() <= s.length()) {
                s += s.substring(0, s.length() - 1);
                System.out.println(
                    s.indexOf(p) == -1? "No": "Yes"
                );
            }
        }
    }
}