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();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
} 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();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    } 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 String[] s = S.split(""); s S.split("") S.split S "" String ans = "No"; ans "No" for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        } int i=0; int i=0; i 0 i<s.length i s.length s s.length i++ i++ i {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        } {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        } int idx = 0; idx 0 StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            } int j=0; int j=0; j 0 j<s.length j s.length s s.length j++ j++ j {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            } {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            } idx = i+j idx i+j i j if(i+j > s.length-1) {
                    idx = i+j-s.length;
                } i+j > s.length-1 i+j i j s.length-1 s.length s s.length 1 {
                    idx = i+j-s.length;
                } idx = i+j-s.length idx i+j-s.length i+j i j s.length s s.length sb.append(s[idx]) sb.append sb s[idx] s idx if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            } String.valueOf(sb).equals(T) String.valueOf(sb).equals String.valueOf(sb) String.valueOf String sb T {
                ans = "Yes";
                break;
            } ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    } min {
        if(a <= b) return a;
        else return b;
    } if(a <= b) return a;
        else return b; a <= b a b return a; a return b; b int a a int b b public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    } max {
        if(a <= b) return b;
        else return a;
    } if(a <= b) return b;
        else return a; a <= b a b return b; b return a; a int a a int b b public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
} 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();
        String[] s = S.split("");
        
        String ans = "No";
        for(int i=0; i<s.length; i++) {
            int idx = 0;
            StringBuilder sb = new StringBuilder();
            for(int j=0; j<s.length; j++) {
                idx = i+j;
                if(i+j > s.length-1) {
                    idx = i+j-s.length;
                }
                sb.append(s[idx]);
            }
            if(String.valueOf(sb).equals(T)) {
                ans = "Yes";
                break;
            }
        }
        System.out.println(ans);
    }
    public static int min(int a, int b) {
        if(a <= b) return a;
        else return b;
    }
    public static int max(int a, int b) {
        if(a <= b) return b;
        else return a;
    }
}