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

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) String s = in.readLine(); s in.readLine() in.readLine in String t = in.readLine(); t in.readLine() in.readLine in String s_rt = ""; s_rt "" boolean matchingFlg = false; matchingFlg false for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    } int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    } {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    } s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i) s_rt s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i) s.substring(s.length()-i,s.length()) s.substring s s.length()-i s.length() s.length s i s.length() s.length s s.substring(0,s.length()-i) s.substring s 0 s.length()-i s.length() s.length s i if(s_rt.equals(t))
        matchingFlg = true; s_rt.equals(t) s_rt.equals s_rt t matchingFlg = true matchingFlg true System.out.println(matchingFlg==true?"Yes":"No") System.out.println System.out System System.out matchingFlg==true?"Yes":"No" matchingFlg==true matchingFlg true "Yes" "No" String[] args args public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    String s = in.readLine();
    String t = in.readLine();
    String s_rt = "";
    boolean matchingFlg = false;
    for(int i=0; i<s.length(); i++) {
      s_rt = s.substring(s.length()-i,s.length()) + s.substring(0,s.length()-i);
      if(s_rt.equals(t))
        matchingFlg = true;
    }
    System.out.println(matchingFlg==true?"Yes":"No");
  }
}