import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s, b;
        String c;
        int count = 0;
        int j = 0;
        try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s, b;
        String c;
        int count = 0;
        int j = 0;
        try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
} Main public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s, b;
        String c;
        int count = 0;
        int j = 0;
        try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s, b;
        String c;
        int count = 0;
        int j = 0;
        try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s s b; b String c; c int count = 0; count 0 int j = 0; j 0 try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } IOException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } s = br.readLine() s br.readLine() br.readLine br b = br.readLine() b br.readLine() br.readLine br c = s + s c s + s s s for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            } int i = 0; int i = 0; i 0 i < c.length() - b.length() i c.length() - b.length() c.length() c.length c b.length() b.length b i++ i++ i {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            } {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            } if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                } b.equals(c.substring(i, i + b.length())) b.equals b c.substring(i, i + b.length()) c.substring c i i + b.length() i b.length() b.length b {
                    System.out.println("Yes");
                    return;
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s, b;
        String c;
        int count = 0;
        int j = 0;
        try {
            s = br.readLine();
            b = br.readLine();
            c = s + s;
            for (int i = 0; i < c.length() - b.length(); i++) {
                if (b.equals(c.substring(i, i + b.length()))) {
                    System.out.println("Yes");
                    return;
                }
            }
            System.out.println("No");

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
