import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    }

} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    }

} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    } main {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) String str = in.nextLine(); str in.nextLine() in.nextLine in String res = in.nextLine(); res in.nextLine() in.nextLine in in.close() in.close in boolean isMatch = false; isMatch false String ans = isMatch ? "Yes" : "No"; ans isMatch ? "Yes" : "No" isMatch "Yes" "No" System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    }

} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    }

} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        String res = in.nextLine();
        in.close();
        boolean isMatch = false;

        loop:
        for (int i = 0; i < str.length(); i++) {
            for (int j = 0; j < str.length(); j++) {
                if (str.charAt(j) != res.charAt((i+j)%str.length())) {
                    break;
                } else if (j == str.length() - 1 && str.charAt(j) == res.charAt( (i+j) % str.length() )) {
                    isMatch = true;
                    break loop;
                }
            }
        }

        String ans = isMatch ? "Yes" : "No";
        System.out.println(ans);
    }

}