import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  }

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

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  }

} Main public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  } main {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  } Scanner stdin = new Scanner(System.in); stdin new Scanner(System.in) String s = stdin.next(); s stdin.next() stdin.next stdin String p = stdin.next(); p stdin.next() stdin.next stdin String ss = s + s; ss s + s s s System.out.println(ss.contains(p) ? "Yes" : "No") System.out.println System.out System System.out ss.contains(p) ? "Yes" : "No" ss.contains(p) ss.contains ss p "Yes" "No" String[] args args public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  }

} public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  }

} Main
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner stdin = new Scanner(System.in);
    String s = stdin.next();
    String p = stdin.next();
    String ss = s + s;
    System.out.println(ss.contains(p) ? "Yes" : "No");
  }

}