import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            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();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }    
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } 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 int l = s.length(); l s.length() s.length s boolean ans = false; ans false for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        } int i = 0; int i = 0; i 0 i < l i l i++ i++ i {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        } {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        } int count = 0; count 0 for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            } int j = 0; int j = 0; j 0 j < l j l j++ j++ j {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            } {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            } if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                } i + j < l i + j i j l {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } if (s.charAt(j) == t.charAt(j + i)) count++; s.charAt(j) == t.charAt(j + i) s.charAt(j) s.charAt s j t.charAt(j + i) t.charAt t j + i j i count++ count {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                } if (s.charAt(j) == t.charAt(j + i - l)) count++; s.charAt(j) == t.charAt(j + i - l) s.charAt(j) s.charAt s j t.charAt(j + i - l) t.charAt t j + i - l j + i j i l count++ count if (count == l) ans = true; count == l count l ans = true ans true if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } ans {
            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) throws Exception {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            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();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            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();
        String t = sc.next();
        int l = s.length();
        boolean ans = false;
        for (int i = 0; i < l; i++) {
            int count = 0;
            for (int j = 0; j < l; j++) {
                if (i + j < l) {
                    if (s.charAt(j) == t.charAt(j + i)) count++;
                } else {
                    if (s.charAt(j) == t.charAt(j + i - l)) count++;
                }
            }
            if (count == l) ans = true;
        }
        if (ans) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }    
}
