import java.util.Scanner;

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

public class Main {
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      String s = sc.nextLine();
      String p = sc.nextLine();
      String ss = s + s;
      int OK = 0;
      int[] check = new int[s.length()];
      for(int i = 0; i < s.length(); i++){
        for(int j = 0; j < p.length(); j++){
          char pj = p.charAt(j);
          char ssj = ss.charAt(j+i);
          if (pj == ssj) check[i] ++; 
        }
      }
      for (int i = 0; i < s.length(); i++) {
        if (check[i] == p.length()) {
        System.out.println("Yes");
        OK = 1;
        break;
        }
      }
      if (OK == 0) System.out.println("No");
    }
}
