import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    }

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

    public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    }

} Main public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    } main {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    } Scanner cin = new Scanner(System.in); cin new Scanner(System.in) String a = cin.nextLine(); a cin.nextLine() cin.nextLine cin String b = cin.nextLine(); b cin.nextLine() cin.nextLine cin int len = a.length(); len a.length() a.length a for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        } int i=0; int i=0; i 0 i<len i len i++ i++ i {
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        } {
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        } if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            } a.charAt(0)==b.charAt(i) a.charAt(0) a.charAt a 0 b.charAt(i) b.charAt b i {
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            } String tempB = b.substring(i, len) + b.substring(0, i); tempB b.substring(i, len) + b.substring(0, i) b.substring(i, len) b.substring b i len b.substring(0, i) b.substring b 0 i if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                } tempB.equals(a) tempB.equals tempB a {
                    System.out.println("Yes");
                    return;
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" return; String[] args args public class Main {

    public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    }

} public class Main {

    public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

//        String a = "kyoto";
//        String b = "tokyo";

        Scanner cin = new Scanner(System.in);
        String a = cin.nextLine();
        String b = cin.nextLine();
        int len = a.length();
        for (int i=0;i<len;i++){
            if (a.charAt(0)==b.charAt(i)){
                String tempB = b.substring(i, len) + b.substring(0, i);
                //System.out.println(tempB);
                if (tempB.equals(a)) {
                    System.out.println("Yes");
                    return;
                }
            }

        }
        System.out.println("No");
        return;

    }

}