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();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  }
} 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();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  } 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 int n = s.length(); n s.length() s.length s StringBuilder buf = new StringBuilder(); buf new StringBuilder() for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    } {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    } buf.append(t.substring(i)) buf.append buf t.substring(i) t.substring t i if (i>0) {
        buf.append(t.substring(0,i));
      } i>0 i 0 {
        buf.append(t.substring(0,i));
      } buf.append(t.substring(0,i)) buf.append buf t.substring(0,i) t.substring t 0 i if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      } s.equals(buf.toString()) s.equals s buf.toString() buf.toString buf {
        System.out.println("Yes");
        return;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; buf.delete(0,n) buf.delete buf 0 n 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);
    String s = sc.next();
    String t = sc.next();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  }
} public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  }
} 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();
    int n = s.length();
    StringBuilder buf = new StringBuilder();
    for (int i = 0;i<n;i++) {
      buf.append(t.substring(i));
      if (i>0) {
        buf.append(t.substring(0,i));
      }
      if (s.equals(buf.toString())) {
        System.out.println("Yes");
        return;
      }
      buf.delete(0,n);
    }
    System.out.println("No");
  }
}
