import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    } main {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] A = new int[26]; A new int[26] 26 Arrays.fill(A, 0) Arrays.fill Arrays A 0 String str; str boolean flag = false; flag false String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc s = s + s s s + s s s for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        } int i=0; int i=0; i 0 i<s.length()/2 i s.length()/2 s.length() s.length s 2 i++ i++ i {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        } {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        } if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            } s.substring(i, i+t.length()).equals(t) s.substring(i, i+t.length()).equals s.substring(i, i+t.length()) s.substring s i i+t.length() i t.length() t.length t t {
                System.out.println("Yes");
                flag = true;
                break;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" flag = true flag true break; if (flag == false) {
            System.out.println("No");
        } flag == false flag false {
            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) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    }
} Main
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //StringBuilder bd = new StringBuilder();
        //ArrayList<Integer> A = new ArrayList<Integer>();
        int[] A = new int[26];
        Arrays.fill(A, 0);
        String str;

        boolean flag = false;

        String s = sc.next();
        String t = sc.next();

        s = s + s;

        for (int i=0; i<s.length()/2; i++) {
            if (s.substring(i, i+t.length()).equals(t)) {
                System.out.println("Yes");
                flag = true;
                break;
            }
        }
        if (flag == false) {
            System.out.println("No");
        }

    }
}
