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();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} 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();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} Main public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    } main {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    } 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 sc.close() sc.close sc List<String> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        } {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        } String head = s.substring(i, s.length()); head s.substring(i, s.length()) s.substring s i s.length() s.length s String foot = s.substring(0, i); foot s.substring(0, i) s.substring s 0 i String word = head + foot; word head + foot head foot list.add(word) list.add list word boolean judge = list.contains(t); judge list.contains(t) list.contains list t String result = judge ? "Yes" : "No"; result judge ? "Yes" : "No" judge "Yes" "No" System.out.println(result) System.out.println System.out System System.out result 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();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
} 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();
        sc.close();

        // 主処理
        List<String> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            String head = s.substring(i, s.length());
            String foot = s.substring(0, i);
            String word = head + foot;
            list.add(word);
        }
        boolean judge = list.contains(t);
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
    }
}
