

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

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    } main {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    } final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) String first = in.nextLine(); first in.nextLine() in.nextLine in first += first first first final String second = in.nextLine(); second in.nextLine() in.nextLine in System.out.println(first.contains(second) ? "Yes" : "No") System.out.println System.out System System.out first.contains(second) ? "Yes" : "No" first.contains(second) first.contains first second "Yes" "No" String[] args args public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    }
} public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    }
} Main


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

public final class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String first = in.nextLine();
        first += first;
        final String second = in.nextLine();
        System.out.println(first.contains(second) ? "Yes" : "No");
    }
}
