import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int[] count = new int[26];
        char c;
        String str1, str2, temp;
        for (int i = 0; i < 26; i++) 
            count[i] = 0;
        Scanner sc = new Scanner(System.in);
        str1 = sc.next();
        str2 = sc.next();

        for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        int[] count = new int[26];
        char c;
        String str1, str2, temp;
        for (int i = 0; i < 26; i++) 
            count[i] = 0;
        Scanner sc = new Scanner(System.in);
        str1 = sc.next();
        str2 = sc.next();

        for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        int[] count = new int[26];
        char c;
        String str1, str2, temp;
        for (int i = 0; i < 26; i++) 
            count[i] = 0;
        Scanner sc = new Scanner(System.in);
        str1 = sc.next();
        str2 = sc.next();

        for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        }
    } main {
        int[] count = new int[26];
        char c;
        String str1, str2, temp;
        for (int i = 0; i < 26; i++) 
            count[i] = 0;
        Scanner sc = new Scanner(System.in);
        str1 = sc.next();
        str2 = sc.next();

        for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        }
    } int[] count = new int[26]; count new int[26] 26 char c; c String str1 str1 str2 str2 temp; temp for (int i = 0; i < 26; i++) 
            count[i] = 0; int i = 0; int i = 0; i 0 i < 26 i 26 i++ i++ i count[i] = 0; count[i] = 0 count[i] count i 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) str1 = sc.next() str1 sc.next() sc.next sc str2 = sc.next() str2 sc.next() sc.next sc for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        } int i = 0; int i = 0; i 0 i < str1.length() i str1.length() str1.length str1 i++ i++ i {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        } {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        } temp = "" temp "" for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length()); int j = 0; int j = 0; j 0 j < str2.length() j str2.length() str2.length str2 j++ j++ j temp += str1.charAt((i+j) % str1.length()); temp += str1.charAt((i+j) % str1.length()) temp str1.charAt((i+j) % str1.length()) str1.charAt str1 (i+j) % str1.length() (i+j) i j str1.length() str1.length str1 if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } temp.equals(str2) temp.equals temp str2 {
                System.out.println("Yes");
                break;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if (i == str1.length() - 1)
                System.out.println("No"); i == str1.length() - 1 i str1.length() - 1 str1.length() str1.length str1 1 System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        int[] count = new int[26];
        char c;
        String str1, str2, temp;
        for (int i = 0; i < 26; i++) 
            count[i] = 0;
        Scanner sc = new Scanner(System.in);
        str1 = sc.next();
        str2 = sc.next();

        for(int i = 0; i < str1.length(); i++) {
            temp = "";
            for (int j = 0; j < str2.length(); j++) 
                temp += str1.charAt((i+j) % str1.length());
            if (temp.equals(str2)) {
                System.out.println("Yes");
                break;
            } 
            if (i == str1.length() - 1)
                System.out.println("No");
        }
    }
}
