import java.util.Scanner;

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

       String str = scan.nextLine();
       String str2 = scan.nextLine();
       boolean a = false;

       for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       }

       if(a){
          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 scan = new Scanner(System.in);

       String str = scan.nextLine();
       String str2 = scan.nextLine();
       boolean a = false;

       for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       }

       if(a){
          System.out.println("Yes");
       }else{
          System.out.println("No");
       }

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

       String str = scan.nextLine();
       String str2 = scan.nextLine();
       boolean a = false;

       for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       }

       if(a){
          System.out.println("Yes");
       }else{
          System.out.println("No");
       }

       } main {
       Scanner scan = new Scanner(System.in);

       String str = scan.nextLine();
       String str2 = scan.nextLine();
       boolean a = false;

       for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       }

       if(a){
          System.out.println("Yes");
       }else{
          System.out.println("No");
       }

       } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String str = scan.nextLine(); str scan.nextLine() scan.nextLine scan String str2 = scan.nextLine(); str2 scan.nextLine() scan.nextLine scan boolean a = false; a false for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       } int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       } {

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       } str =str.charAt(str.length()-1)+str.substring(0,str.length()-1) str str.charAt(str.length()-1)+str.substring(0,str.length()-1) str.charAt(str.length()-1) str.charAt str str.length()-1 str.length() str.length str 1 str.substring(0,str.length()-1) str.substring str 0 str.length()-1 str.length() str.length str 1 String str3 =str.substring(0,str2.length()); str3 str.substring(0,str2.length()) str.substring str 0 str2.length() str2.length str2 if(str3.equals(str2)){

                a = true;

             } str3.equals(str2) str3.equals str3 str2 {

                a = true;

             } a = true a true if(a){
          System.out.println("Yes");
       }else{
          System.out.println("No");
       } a {
          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 scan = new Scanner(System.in);

       String str = scan.nextLine();
       String str2 = scan.nextLine();
       boolean a = false;

       for(int i=0;i<str.length();i++){

          str =str.charAt(str.length()-1)+str.substring(0,str.length()-1);

          String str3 =str.substring(0,str2.length());

             if(str3.equals(str2)){

                a = true;

             }

       }

       if(a){
          System.out.println("Yes");
       }else{
          System.out.println("No");
       }

       }
   }
