import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

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

}
 import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

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

} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

        scan.close();
        System.out.println("No");
        return;
    } main {
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

        scan.close();
        System.out.println("No");
        return;
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str str x; x int i i j j ok; ok ok = 0 ok 0 str = scan.nextLine() str scan.nextLine() scan.nextLine scan x = scan.nextLine() x scan.nextLine() scan.nextLine scan for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        } i=0; i=0 i 0 i<str.length() i str.length() str.length str i++ i++ i {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        } {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        } str.charAt(i) str.charAt str i for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             } j=0; j=0 j 0 j<x.length() j x.length() x.length x j++ j++ j {
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             } {
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             } if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 } str.charAt((i+j)%str.length())!=x.charAt(j) str.charAt((i+j)%str.length()) str.charAt str (i+j)%str.length() (i+j) i j str.length() str.length str x.charAt(j) x.charAt x j {
                     ok = 0;
                     break;
                 } ok = 0 ok 0 break; ok++ ok if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             } ok == x.length() ok x.length() x.length x {
                 System.out.println("Yes");
                 scan.close();
                 return;
             } System.out.println("Yes") System.out.println System.out System System.out "Yes" scan.close() scan.close scan return; scan.close() scan.close scan 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){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

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

} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

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

} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        String str,x;
        int i,j,ok;
        ok = 0;
        str = scan.nextLine();
        x = scan.nextLine();
        //StringBuilder sb = new StringBuilder();
        for ( i=0; i<str.length(); i++) {
             str.charAt(i);
             for(j=0; j<x.length();j++){
                 if(str.charAt((i+j)%str.length())!=x.charAt(j)){
                     ok = 0;
                     break;
                 }
                 ok++;
             }
             if(ok == x.length()){
                 System.out.println("Yes");
                 scan.close();
                 return;
             }

        }
        

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

}

