import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

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

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

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

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  } main {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc sc.close() sc.close sc String[] s = S.split(""); s S.split("") S.split S "" int[] arr = new int[s.length]; arr new int[s.length] s.length s s.length String result = "No"; result "No" for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    } {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    } for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      } int j = 0; int j = 0; j 0 j < s.length j s.length s s.length j++ j++ j {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      } {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      } if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        } i + j < s.length i + j i j s.length s s.length {
          arr[j] = i + j;
        } arr[j] = i + j arr[j] arr j i + j i j {
          arr[j] = i + j - s.length;
        } arr[j] = i + j - s.length arr[j] arr j i + j - s.length i + j i j s.length s s.length String s_ = ""; s_ "" for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      } int j = 0; int j = 0; j 0 j < s.length j s.length s s.length j++ j++ j {
        s_ += s[arr[j]];
      } {
        s_ += s[arr[j]];
      } s_ += s[arr[j]] s_ s[arr[j]] s arr[j] arr j if (s_.equals(T)){
        result = "Yes";
        break;
      } s_.equals(T) s_.equals s_ T {
        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) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

} public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

} Main
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();

    sc.close();

    String[] s = S.split("");

    int[] arr = new int[s.length];

    String result = "No";

    for (int i = 0; i < s.length; i++) {
      
      for (int j = 0; j < s.length; j++) {

        if (i + j < s.length) {
          arr[j] = i + j;
        } else {
          arr[j] = i + j - s.length;
        }

      }

      String s_ = "";

      for (int j = 0; j < s.length; j++) {
        s_ += s[arr[j]];
      }

      if (s_.equals(T)){
        result = "Yes";
        break;
      }

    }

    System.out.println(result);

  }

}