import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    }
 } import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    }
 } Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    } main {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) HashMap<String, Integer> hash = new HashMap<String, Integer>(); hash new HashMap<String, Integer>() String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String line1 = sc.nextLine(); line1 sc.nextLine() sc.nextLine sc String[] s = line.split(""); s line.split("") line.split line "" String[] p = line1.split(""); p line1.split("") line1.split line1 "" String answer = "No"; answer "No" for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        } {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        } if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            } s[i].equals(p[0]) s[i].equals s[i] s i p[0] p 0 {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            } String ans = ""; ans "" for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                } int j = 0; int j = 0; j 0 j < p.length j p.length p p.length j++ j++ j {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                } {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                } if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    } i + j < s.length i + j i j s.length s s.length {
                        ans += s[i + j];
                    } ans += s[i + j] ans s[i + j] s i + j i j {
                        ans += s[i + j - s.length];
                    } ans += s[i + j - s.length] ans s[i + j - s.length] s i + j - s.length i + j i j s.length s s.length if(ans.equals(line1)) {
                    answer = "Yes";
                } ans.equals(line1) ans.equals ans line1 {
                    answer = "Yes";
                } answer = "Yes" answer "Yes" System.out.println(answer) System.out.println System.out System System.out answer String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    }
 } public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    }
 } Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String, Integer> hash = new HashMap<String, Integer>();
        String line = sc.nextLine();
        String line1 = sc.nextLine();
        String[] s = line.split("");
        String[] p = line1.split("");
        String answer = "No";
        for(int i = 0; i < s.length; i++) {
            if(s[i].equals(p[0])) {
                String ans = "";
                for(int j = 0; j < p.length; j++) {
                    if(i + j < s.length) {
                        ans += s[i + j];
                    }else {
                        ans += s[i + j - s.length];
                    }
                }
                if(ans.equals(line1)) {
                    answer = "Yes";
                }
            }
        }
        System.out.println(answer);

    }
 }
