import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

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

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

    } main {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"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 String[] Sarr = new String[S.length()]; Sarr new String[S.length()] S.length() S.length S for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        } {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        } Sarr[i] = S.substring(i) + S.substring(0,i) Sarr[i] Sarr i S.substring(i) + S.substring(0,i) S.substring(i) S.substring S i S.substring(0,i) S.substring S 0 i boolean result = false; result false for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        } {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        } if(Sarr[i].equals(T)){
                result = true;
                break;
            } Sarr[i].equals(T) Sarr[i].equals Sarr[i] Sarr i T {
                result = true;
                break;
            } result = true result true break; System.out.println(result ? "Yes":"No") System.out.println System.out System System.out result ? "Yes":"No" result "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();

        String[] Sarr = new String[S.length()];
        for (int i = 0; i < S.length(); i++) {
            Sarr[i] = S.substring(i) + S.substring(0,i);
        }

        boolean result = false;
        for (int i = 0; i < S.length(); i++) {
            if(Sarr[i].equals(T)){
                result = true;
                break;
            }
        }
        System.out.println(result ? "Yes":"No");

    }
}
