import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String[] s = sc.next().split(""); s sc.next().split("") sc.next().split sc.next() sc.next sc "" String t = sc.next(); t sc.next() sc.next sc String concat = ""; concat "" for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        } {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        } concat = s[s.length - 1] concat s[s.length - 1] s s.length - 1 s.length s s.length 1 for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            } int j = 0; int j = 0; j 0 j < s.length - 1 j s.length - 1 s.length s s.length 1 j++ j++ j {
                concat += s[j];
            } {
                concat += s[j];
            } concat += s[j] concat s[j] s j if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            } concat.equals(t) concat.equals concat t {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; s = concat.split("") s concat.split("") concat.split concat "" 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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.next().split("");
        String t = sc.next();
        String concat = "";
        for (int i = 0; i < s.length; i++) {
            concat = s[s.length - 1];
            for (int j = 0; j < s.length - 1; j++) {
                concat += s[j];
            }
            // 一致してたら修了
            if (concat.equals(t)) {
                System.out.println("Yes");
                return;
            }
            // 連結した文字列を分解
            s = concat.split("");
        }
        System.out.println("No");
    }
}
