import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                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.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String t = scanner.next(); t scanner.next() scanner.next scanner int p = 0; p 0 int size = s.length(); size s.length() s.length s while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        } p <= size p size {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        } String s2 = s.substring(p, size) + s.substring(0,p); s2 s.substring(p, size) + s.substring(0,p) s.substring(p, size) s.substring s p size s.substring(0,p) s.substring s 0 p p++ p if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            } s2.equals(t) s2.equals s2 t {
                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 public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        String t = scanner.next();
        int p = 0;
        int size = s.length();
        while (p <= size) {
            String s2 = s.substring(p, size) + s.substring(0,p);
            p++;
            if (s2.equals(t)) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}