import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
} import java.util.Scanner; Scanner 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 index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "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 index = 0; index 0 boolean isWhat = true; isWhat true if (s.length() != t.length()) {
            isWhat = false;
        } s.length() != t.length() s.length() s.length s t.length() t.length t {
            isWhat = false;
        } isWhat = false isWhat false if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        } isWhat {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        } for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            } {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            } index = s.indexOf(t.charAt(0), i) index s.indexOf(t.charAt(0), i) s.indexOf s t.charAt(0) t.charAt t 0 i if (index == -1) {
                    isWhat = false;
                    break;
                } index == -1 index -1 1 {
                    isWhat = false;
                    break;
                } isWhat = false isWhat false break; isWhat = check(s, t, index) isWhat check(s, t, index) check s t index if (isWhat == true)   break; isWhat == true isWhat true break; System.out.println(isWhat ? "Yes" : "No") System.out.println System.out System System.out isWhat ? "Yes" : "No" isWhat "Yes" "No" String[] args args public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    } check {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    } int len = s.length(); len s.length() s.length s boolean re = true; re true int cnt = index; cnt index for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        } int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        } {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        } if (cnt >= len)   cnt = 0; cnt >= len cnt len cnt = 0 cnt 0 if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            } s.charAt(cnt++) != t.charAt(i) s.charAt(cnt++) s.charAt s cnt++ cnt t.charAt(i) t.charAt t i {
                re = false;
                break;
            } re = false re false break; return re; re String s s String t t int index index public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String s = sc.next();
        String t = sc.next();

        int index = 0;
        boolean isWhat = true;
        if (s.length() != t.length()) {
            isWhat = false;
        }
        
        if (isWhat) {
            for (int i = 0; i < s.length(); i++) {
                index = s.indexOf(t.charAt(0), i);
              	if (index == -1) {
                    isWhat = false;
                    break;
                }
              	
                isWhat = check(s, t, index);
                if (isWhat == true)   break;
            }
        }
        
        System.out.println(isWhat ? "Yes" : "No");
    }

    public static boolean check(String s, String t, int index) {
        int len = s.length();
        boolean re = true;
        int cnt = index;
        for (int i = 0; i < len; i++) {
            if (cnt >= len)   cnt = 0;
            if (s.charAt(cnt++) != t.charAt(i)) {
                re = false;
                break;
            }
        }
        return re;
    }
}
