import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  }
} import java.util.*; util.* java import java.util.Collections; Collections java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String A = sc.next(); A sc.next() sc.next sc String ans = "No"; ans "No" for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    } {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    } if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      } S.equals(A) S.equals S A {
        ans = "Yes";
        break;
      } ans = "Yes" ans "Yes" break; {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      } S = S.substring(1, A.length()) + S.substring(0, 1) S S.substring(1, A.length()) + S.substring(0, 1) S.substring(1, A.length()) S.substring S 1 A.length() A.length A S.substring(0, 1) S.substring S 0 1 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  }
} public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  }
} Main
import java.util.*;
import java.util.Collections;
import java.util.stream.Collectors;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String A = sc.next();
    String ans = "No";
    for (int i = 0; i < S.length(); i++) {
      if (S.equals(A)) {
        ans = "Yes";
        break;
      } else {
        S = S.substring(1, A.length()) + S.substring(0, 1);
      }
    }
    System.out.println(ans);

  }
}
