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

class Main
{
  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      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)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br int s_len = s.length(); s_len s.length() s.length s int p_len = p.length(); p_len p.length() p.length p if(s_len < p_len) return; s_len < p_len s_len p_len return; String ss = s + s; ss s + s s s boolean judge = false; judge false for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      } int i = 0; int i = 0; i 0 i < s_len i s_len i++ i++ i {
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      } {
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      } if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        } s.charAt(i) == p.charAt(0) s.charAt(i) s.charAt s i p.charAt(0) p.charAt p 0 {
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        } if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          } p.equals(ss.substring(i, i + p_len)) p.equals p ss.substring(i, i + p_len) ss.substring ss i i + p_len i p_len {
            judge = true;
            break;
          } judge = true judge true break; 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));
      String s = br.readLine();
      String p = br.readLine();
      int s_len = s.length();
      int p_len = p.length();
      if(s_len < p_len) return;

      String ss = s + s;
      boolean judge = false;

      // CHECK
      for(int i = 0; i < s_len; i++){
        if(s.charAt(i) == p.charAt(0)){
          if(p.equals(ss.substring(i, i + p_len))){
            judge = true;
            break;
          }
        }
      }
      // OUTPUT
      if(judge)
        System.out.println("Yes");
      else
        System.out.println("No");
    }catch(Exception e){
      System.out.println(e);
    }
  }
}