import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

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

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

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

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

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

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

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

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

    } main {
        Scanner input = new Scanner(System.in);

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

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

    } Scanner input = new Scanner(System.in); input new Scanner(System.in) String s = input.nextLine(); s input.nextLine() input.nextLine input String p = input.nextLine(); p input.nextLine() input.nextLine input s += s s s System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No") System.out.println System.out System System.out s.matches(".*" + p + ".*") ? "Yes" : "No" s.matches(".*" + p + ".*") s.matches s ".*" + p + ".*" ".*" + p + ".*" ".*" p ".*" "Yes" "No" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

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

        System.out.println(s.matches(".*" + p + ".*") ? "Yes" : "No");

    }
}