import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

} Main public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    } main {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    } try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc boolean isOk = false; isOk false for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            } {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            } boolean tmpFlag = true; tmpFlag true for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                } int j = 0; int j = 0; j 0 j < s.length() j s.length() s.length s j++ j++ j {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                } {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                } if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    } s.charAt(j) != t.charAt((j + i) % s.length()) s.charAt(j) s.charAt s j t.charAt((j + i) % s.length()) t.charAt t (j + i) % s.length() (j + i) j i s.length() s.length s {
                        tmpFlag = false;
                        break;
                    } tmpFlag = false tmpFlag false break; if (tmpFlag) {
                    isOk = true;
                    break;
                } tmpFlag {
                    isOk = true;
                    break;
                } isOk = true isOk true break; if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            } isOk {
                System.out.println("Yes");
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
                System.out.println("No");
            } 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) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

} public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            String s = sc.next();
            String t = sc.next();

            boolean isOk = false;
            for (int i = 0; i < s.length(); i++) {
                boolean tmpFlag = true;
                for (int j = 0; j < s.length(); j++) {
                    if (s.charAt(j) != t.charAt((j + i) % s.length())) {
                        tmpFlag = false;
                        break;
                    }
                }
                if (tmpFlag) {
                    isOk = true;
                    break;
                }
            }

            if (isOk) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }

}
