import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        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.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    } int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    } {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    } int j = 0; j 0 for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      } ; j < p.length() j p.length() p.length p j++ j++ j {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      } {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      } int ptr = i + j; ptr i + j i j if (ptr >= s.length()) {
          ptr -= s.length();
        } ptr >= s.length() ptr s.length() s.length s {
          ptr -= s.length();
        } ptr -= s.length() ptr s.length() s.length s if (s.charAt(ptr) != p.charAt(j)) {
          break;
        } s.charAt(ptr) != p.charAt(j) s.charAt(ptr) s.charAt s ptr p.charAt(j) p.charAt p j {
          break;
        } break; if (j >= p.length()) {
        System.out.println("Yes");
        return;
      } j >= p.length() j p.length() p.length p {
        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
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.nextLine();
    String p = sc.nextLine();
    for (int i = 0; i < s.length(); i++) {
      int j = 0;
      for (; j < p.length(); j++) {
        int ptr = i + j;
        if (ptr >= s.length()) {
          ptr -= s.length();
        }
        if (s.charAt(ptr) != p.charAt(j)) {
          break;
        }
      }
      if (j >= p.length()) {
        System.out.println("Yes");
        return;
      }
    }
    System.out.println("No");
  }
}
