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();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        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);
    String S = sc.next();
    String T = sc.next();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    }
    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();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String T = sc.next();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    }
    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 for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        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 {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    } {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    } boolean found = true; found true for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      } int j = 0; int j = 0; j 0 j < S.length() j S.length() S.length S j++ j++ j {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      } {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      } if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        } S.charAt(j) != T.charAt((i+j) % T.length()) S.charAt(j) S.charAt S j T.charAt((i+j) % T.length()) T.charAt T (i+j) % T.length() (i+j) i j T.length() T.length T {
          found = false;
          break;
        } found = false found false break; if (found) {
        System.out.println("Yes");
        return;
      } found {
        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);
    String S = sc.next();
    String T = sc.next();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    }
    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();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        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);
    String S = sc.next();
    String T = sc.next();
    for (int i = 0; i < T.length(); i++) {
      boolean found = true;
      for (int j = 0; j < S.length(); j++) {
        if (S.charAt(j) != T.charAt((i+j) % T.length())) {
          found = false;
          break;
        }          
      }
      if (found) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}