import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuffer S = new StringBuffer(sc.next()); S new StringBuffer(sc.next()) StringBuffer T = new StringBuffer(sc.next()); T new StringBuffer(sc.next()) for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    } int i = 0; int i = 0; i 0 i < T.length() i T.length() T.length T i++ i++ i {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    } {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    } char top = S.charAt(0); top S.charAt(0) S.charAt S 0 S = new StringBuffer(S.substring(1)) S new StringBuffer(S.substring(1)) S = S.append(top) S S.append(top) S.append S top if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      } S.toString().equals(T.toString()) S.toString().equals S.toString() S.toString S T.toString() T.toString T {
        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 sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuffer S = new StringBuffer(sc.next());
    StringBuffer T = new StringBuffer(sc.next());
    for (int i = 0; i < T.length(); i++) {
      char top = S.charAt(0);
      S = new StringBuffer(S.substring(1));
      S = S.append(top);
      if (S.toString().equals(T.toString())) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}