import java.util.*;

public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
} import java.util.*; util.* java public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
} Main public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    } main {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    } char s[] = sc.next().toCharArray(); s sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc char t[] = sc.next().toCharArray(); t sc.next().toCharArray() sc.next().toCharArray sc.next() sc.next sc int n = s.length; n s.length s s.length for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        } {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        } if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            } s[0] == t[i] s[0] s 0 t[i] t i {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            } boolean isOk = true; isOk true for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                } {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                } if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    } s[j] != t[(i + j) % n] s[j] s j t[(i + j) % n] t (i + j) % n (i + j) i j n {
                        isOk = false;
                        break;
                    } isOk = false isOk false break; if (isOk) {
                    System.out.println("Yes");
                    return;
                } isOk {
                    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" Scanner sc sc public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) new Main().main(sc) new Main().main new Main() sc sc.close() sc.close sc String[] args args public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
} public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
} Main
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        char s[] = sc.next().toCharArray();
        char t[] = sc.next().toCharArray();
        int n = s.length;

        for (int i = 0; i < n; i++) {
            if (s[0] == t[i]) {
                boolean isOk = true;
                for (int j = 0; j < n; j++) {
                    if (s[j] != t[(i + j) % n]) {
                        isOk = false;
                        break;
                    }
                }

                if (isOk) {
                    System.out.println("Yes");
                    return;
                }
            }
        }

        System.out.println("No");
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        new Main().main(sc);
        sc.close();
    }
}
