import java.util.Scanner;

class Main {
    public static void main(String... args) {
        String S = IN.next();
        String T = IN.next();
        int z = S.length();
        boolean flag = false;
        for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        }
        puts(flag ? "Yes" : "No");
    }
    static final Scanner IN = new Scanner(System.in);
    static <T> void puts(T arg) { System.out.println(arg); }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String... args) {
        String S = IN.next();
        String T = IN.next();
        int z = S.length();
        boolean flag = false;
        for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        }
        puts(flag ? "Yes" : "No");
    }
    static final Scanner IN = new Scanner(System.in);
    static <T> void puts(T arg) { System.out.println(arg); }
} Main static final Scanner IN = new Scanner(System.in); IN new Scanner(System.in) public static void main(String... args) {
        String S = IN.next();
        String T = IN.next();
        int z = S.length();
        boolean flag = false;
        for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        }
        puts(flag ? "Yes" : "No");
    } main {
        String S = IN.next();
        String T = IN.next();
        int z = S.length();
        boolean flag = false;
        for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        }
        puts(flag ? "Yes" : "No");
    } String S = IN.next(); S IN.next() IN.next IN String T = IN.next(); T IN.next() IN.next IN int z = S.length(); z S.length() S.length S boolean flag = false; flag false for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < z i z i++ i++ i {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        } {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        } String x = S.substring(z - i - 1) + S.substring(0, z - i - 1); x S.substring(z - i - 1) + S.substring(0, z - i - 1) S.substring(z - i - 1) S.substring S z - i - 1 z - i - 1 z i 1 S.substring(0, z - i - 1) S.substring S 0 z - i - 1 z - i - 1 z i 1 if (x.equals(T)) {
                flag = true;
                break;
            } x.equals(T) x.equals x T {
                flag = true;
                break;
            } flag = true flag true break; puts(flag ? "Yes" : "No") puts flag ? "Yes" : "No" flag "Yes" "No" String... args args static <T> void puts(T arg) { System.out.println(arg); } puts { System.out.println(arg); } System.out.println(arg) System.out.println System.out System System.out arg T arg arg
import java.util.Scanner;

class Main {
    public static void main(String... args) {
        String S = IN.next();
        String T = IN.next();
        int z = S.length();
        boolean flag = false;
        for (int i = 0; i < z; i++) {
            String x = S.substring(z - i - 1) + S.substring(0, z - i - 1);
            if (x.equals(T)) {
                flag = true;
                break;
            }
        }
        puts(flag ? "Yes" : "No");
    }
    static final Scanner IN = new Scanner(System.in);
    static <T> void puts(T arg) { System.out.println(arg); }
}