import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String T = sc.next(); T sc.next() sc.next sc String R = sc.next(); R sc.next() sc.next sc int flgsub = 0; flgsub 0 int flag = 0; flag 0 for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        } {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        } T = T.substring(1,T.length()) + T.substring(0,1) T T.substring(1,T.length()) + T.substring(0,1) T.substring(1,T.length()) T.substring T 1 T.length() T.length T T.substring(0,1) T.substring T 0 1 if(T.equals(R)){
                flag =1;
            } T.equals(R) T.equals T R {
                flag =1;
            } flag =1 flag 1 if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        } flag == 0 flag 0 {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String T = sc.next();
        String R = sc.next();

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


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

        int flgsub = 0;
        int flag = 0;

        for (int i = 0; i < T.length(); i++) {
            T = T.substring(1,T.length()) + T.substring(0,1);
            if(T.equals(R)){
                flag =1;
            }
        }
        if(flag == 0){
            System.out.println("No");
        }else{
            System.out.println("Yes");
        }

    }
}
