import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    } main {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.nextLine(); str sc.nextLine() sc.nextLine sc String str2 = sc.nextLine(); str2 sc.nextLine() sc.nextLine sc int size = str.length(); size str.length() str.length str int size2 = str2.length(); size2 str2.length() str2.length str2 int flag =1; flag 1 while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        } true {
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        } if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            } str.equals(str2) str.equals str str2 {
                break;
            } break; {
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            } size2 = size2-1 size2 size2-1 size2 1 String str3 = str.substring(0,1); str3 str.substring(0,1) str.substring str 0 1 str = str.substring(1,size) str str.substring(1,size) str.substring str 1 size str = str.concat(str3) str str.concat(str3) str.concat str str3 if(size2==0){
                    flag=0;
                    break;
                } size2==0 size2 0 {
                    flag=0;
                    break;
                } flag=0 flag 0 break; if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        } flag==1 flag 1 {
            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
import java.util.Scanner;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        String str2 = sc.nextLine();
        int size = str.length();
        int size2 = str2.length();
        int flag =1;

        while(true){
            if(str.equals(str2)){
                break;
            }else{
                size2 = size2-1;
                String str3 = str.substring(0,1);
                str = str.substring(1,size);
                str = str.concat(str3);
                if(size2==0){
                    flag=0;
                    break;
                }
            }
        }
        if(flag==1){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
        
    }
}