import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

} import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

} Main public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  } main {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan String text = String.join("", s, s); text String.join("", s, s) String.join String "" s s for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    } int i = 0; int i = 0; i 0 i < text.length() i text.length() text.length text i++ i++ i {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    } {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    } if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      } text.regionMatches(i, p, 0, p.length()) text.regionMatches text i p 0 p.length() p.length p {
        System.out.println("Yes");
        return;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

} public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    String p = scan.nextLine();

    String text = String.join("", s, s);

    for (int i = 0; i < text.length(); i++) {
      if(text.regionMatches(i, p, 0, p.length())) {
        System.out.println("Yes");
        return;
      }
    }
    
    System.out.println("No");
  }

}
