import java.util.Scanner;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String p = sc.nextLine();
        p = p + p;
        String s = sc.nextLine();

        int lenp = p.length();
        int lens = s.length();

        boolean result = false;
        for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        }
        System.out.println((result ? "Yes" : "No"));

    }



} import java.util.Scanner; Scanner java.util class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String p = sc.nextLine();
        p = p + p;
        String s = sc.nextLine();

        int lenp = p.length();
        int lens = s.length();

        boolean result = false;
        for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        }
        System.out.println((result ? "Yes" : "No"));

    }



} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String p = sc.nextLine();
        p = p + p;
        String s = sc.nextLine();

        int lenp = p.length();
        int lens = s.length();

        boolean result = false;
        for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        }
        System.out.println((result ? "Yes" : "No"));

    } main {

        Scanner sc = new Scanner(System.in);

        String p = sc.nextLine();
        p = p + p;
        String s = sc.nextLine();

        int lenp = p.length();
        int lens = s.length();

        boolean result = false;
        for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        }
        System.out.println((result ? "Yes" : "No"));

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc p = p + p p p + p p p String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc int lenp = p.length(); lenp p.length() p.length p int lens = s.length(); lens s.length() s.length s boolean result = false; result false for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        } int i = 0; int i = 0; i 0 i <= lenp - lens i lenp - lens lenp lens i++ i++ i {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        } {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        } if (p.substring(i, i + lens).equals(s)) {
                result = true;
            } p.substring(i, i + lens).equals(s) p.substring(i, i + lens).equals p.substring(i, i + lens) p.substring p i i + lens i lens s {
                result = true;
            } result = true result true System.out.println((result ? "Yes" : "No")) System.out.println System.out System System.out (result ? "Yes" : "No") result "Yes" "No" String[] args args
import java.util.Scanner;

class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String p = sc.nextLine();
        p = p + p;
        String s = sc.nextLine();

        int lenp = p.length();
        int lens = s.length();

        boolean result = false;
        for (int i = 0; i <= lenp - lens; i++) {
            if (p.substring(i, i + lens).equals(s)) {
                result = true;
            }
        }
        System.out.println((result ? "Yes" : "No"));

    }



}
