import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          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 line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }
} Main public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    } main {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String S = line + line; S line + line line line char[] s = S.toCharArray(); s S.toCharArray() S.toCharArray S line = sc.nextLine() line sc.nextLine() sc.nextLine sc char[] p = line.toCharArray(); p line.toCharArray() line.toCharArray line int check = 0; check 0 if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        } check == 1 check 1 {
          System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
          System.out.println("No");
        } 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 line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        String line = sc.nextLine();
        String S = line + line;
        char[] s = S.toCharArray();

        line = sc.nextLine();
        char[] p = line.toCharArray();

        int check = 0;

        point:
        for(int i = 0; i < s.length; i++) {
          if(s[i] == p[0]) {
            for(int j = 0; j < p.length; j++) {
              if(i + j == s.length) {
                break point;
              } else if(s[i + j] != p[j]) {
                break;
              } else if(j == p.length - 1) {
                check = 1;
                break point;
              }
            }
          }
        }

        if(check == 1) {
          System.out.println("Yes");
        } else {
          System.out.println("No");
        }
    }
}