import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    } main {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String string = scan.nextLine(); string scan.nextLine() scan.nextLine scan String strings = string + string; strings string + string string string String keywords = scan.nextLine(); keywords scan.nextLine() scan.nextLine scan System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No") System.out.println System.out System System.out strings.matches(".*" + keywords + ".*")? "Yes" : "No" strings.matches(".*" + keywords + ".*") strings.matches strings ".*" + keywords + ".*" ".*" + keywords + ".*" ".*" keywords ".*" "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String string = scan.nextLine();
        String strings = string + string;
        String keywords = scan.nextLine();

        System.out.println(strings.matches(".*" + keywords + ".*")? "Yes" : "No");
    }
}