
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

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

  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

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

  }
} Main public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

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

  } main {
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

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

  } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] original =  br.readLine().split(""); original br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" String[] serch =  br.readLine().split(""); serch br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" int flag = 0; flag 0 for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for int i = 0; int i = 0; i 0 i < original.length i original.length original original.length i++ i++ i {
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for {
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   } if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if serch[0].equals(original[i]) serch[0].equals serch[0] serch 0 original[i] original i {
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  } int j ; j int k = i; k i int count = 0; count 0 for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for j = 0; j = 0 j 0 j<serch.length j serch.length serch serch.length j++,k++ j++ j k++ k {
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for {
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     } if(k == original.length){

	        	 k = 0;

	         }//if k == original.length k original.length original original.length {

	        	 k = 0;

	         } k = 0 k 0 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if serch[j].equals( original[k]) serch[j].equals serch[j] serch j original[k] original k {

	        	 count++;;

	         } count++ count if(count == serch.length){
	        flag = 1;
	     } count == serch.length count serch.length serch serch.length {
	        flag = 1;
	     } flag = 1 flag 1 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.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
  public static void main(String args[]) throws IOException{
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

   String[] original =  br.readLine().split("");
   String[] serch =  br.readLine().split("");

   int flag = 0;
   for(int i = 0; i < original.length; i++){
	  if(serch[0].equals(original[i])){
	     int j ;//serch?????????????????????
	     int k = i;//original?????????????????????
	     int count = 0;
	     for(j = 0;j<serch.length;j++,k++){
	         if(k == original.length){

	        	 k = 0;

	         }//if


	    	 if( serch[j].equals( original[k]) ){

	        	 count++;;

	         }//if
	     }//for

	     if(count == serch.length){
	        flag = 1;
	     }
	  }//if
   }//for

   if(flag == 1){

	   System.out.println("Yes");

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

  }
}