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

public class Main {

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  } main {
    
    try( BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  } try( BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    } {

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String result = "No"; result "No" String inStr  = br.readLine(); inStr br.readLine() br.readLine br String target = br.readLine(); target br.readLine() br.readLine br String ring = inStr + inStr; ring inStr + inStr inStr inStr if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        } inStr.length() >= target.length() inStr.length() inStr.length inStr target.length() target.length target for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        } int i = 0; int i = 0; i 0 i < inStr.length() i inStr.length() inStr.length inStr i++ i++ i {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        } {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        } if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          } target.charAt(0) == ring.charAt(i) target.charAt(0) target.charAt target 0 ring.charAt(i) ring.charAt ring i {
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          } if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            } target.equals(ring.substring(i, i+target.length())) target.equals target ring.substring(i, i+target.length()) ring.substring ring i i+target.length() i target.length() target.length target {
              result = "Yes";
              break;
            } result = "Yes" result "Yes" break; System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  }
} public class Main {

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

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

      String result = "No";
      String inStr  = br.readLine();
      String target = br.readLine();
      String ring = inStr + inStr;

      if( inStr.length() >= target.length())
        for(int i = 0; i < inStr.length(); i++) {
          if( target.charAt(0) == ring.charAt(i) ){
            if(target.equals(ring.substring(i, i+target.length()))) {
              result = "Yes";
              break;
            }
          }
        }

      System.out.println(result);
    }
  }
}
