/* ITP1_8_D */
import java.io.*;

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

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
} import java.io.*; io.* java class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
} Main public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  } try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      StringBuilder sb = new StringBuilder();

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br if(s.length() < p.length()) return; s.length() < p.length() s.length() s.length s p.length() p.length p return; boolean judge = false; judge false char[] s_char = s.toCharArray(); s_char s.toCharArray() s.toCharArray s for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } {
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      } if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        } s_char[i] == p.charAt(0) s_char[i] s_char i p.charAt(0) p.charAt p 0 {
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        } if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          } ((i + 1) + p.length()) > s.length() ((i + 1) + p.length()) (i + 1) i 1 p.length() p.length p s.length() s.length s {
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          } sb.append(s.substring(i, s.length())) sb.append sb s.substring(i, s.length()) s.substring s i s.length() s.length s sb.append(s.substring(0, (p.length() - (s.length() - i)))) sb.append sb s.substring(0, (p.length() - (s.length() - i))) s.substring s 0 (p.length() - (s.length() - i)) p.length() p.length p (s.length() - i) s.length() s.length s i {
            sb.append(s.substring(i, i + p.length()));
          } sb.append(s.substring(i, i + p.length())) sb.append sb s.substring(i, i + p.length()) s.substring s i i + p.length() i p.length() p.length p if(p.equals(sb.toString())) judge = true; p.equals(sb.toString()) p.equals p sb.toString() sb.toString sb judge = true judge true sb.delete(0, sb.length()) sb.delete sb 0 sb.length() sb.length sb if(judge)
        System.out.println("Yes");
      else
        System.out.println("No"); judge System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
/* ITP1_8_D */
import java.io.*;

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

      String s = br.readLine();
      String p = br.readLine();
      if(s.length() < p.length()) return;
      boolean judge = false;

      char[] s_char = s.toCharArray();

      for(int i = 0; i < s.length(); i++){
        if(s_char[i] == p.charAt(0)){
          if( ((i + 1) + p.length()) > s.length() ){
            sb.append(s.substring(i, s.length()));
            sb.append(s.substring(0, (p.length() - (s.length() - i))));
          }else {
            sb.append(s.substring(i, i + p.length()));
          }
          if(p.equals(sb.toString())) judge = true;
          //System.out.println("i:" + i + " p:" + p + " sb:" + sb + " judge:" + judge);
          sb.delete(0, sb.length());
        }
      }

      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");

    }catch(Exception e){
      System.out.println(e);
    }
  }
}