import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc int n = s.length(); n s.length() s.length s for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        } {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        } boolean ok = true; ok true for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            } int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            } {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            } if (s.charAt((i + j) % n) != t.charAt(j)) ok = false; s.charAt((i + j) % n) != t.charAt(j) s.charAt((i + j) % n) s.charAt s (i + j) % n (i + j) i j n t.charAt(j) t.charAt t j ok = false ok false if (ok) {
                System.out.println("Yes");
                return;
            } ok {
                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 sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int n = s.length();
        for (int i = 0; i < n; i++) {
            boolean ok = true;
            for (int j = 0; j < n; j++) {
                if (s.charAt((i + j) % n) != t.charAt(j)) ok = false;
            }
            if (ok) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}