import java.util.*;

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

        for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.*; util.* java class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();

        for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();

        for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        String t = scanner.nextLine();

        for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner String t = scanner.nextLine(); t scanner.nextLine() scanner.nextLine scanner for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        } {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        } String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i)); rotated String.format("%s%s", s.substring(i, s.length()), s.substring(0, i)) String.format String "%s%s" s.substring(i, s.length()) s.substring s i s.length() s.length s s.substring(0, i) s.substring s 0 i if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            } t.equals(rotated) t.equals t rotated {
                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" String[] args args
import java.util.*;

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

        for (int i = 0; i < s.length(); i++) {
            String rotated = String.format("%s%s", s.substring(i, s.length()), s.substring(0, i));
            if (t.equals(rotated)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}
