import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
}
 import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder sb = new StringBuilder(); sb new StringBuilder() String[] str = sc.nextLine().split(""); str sc.nextLine().split("") sc.nextLine().split sc.nextLine() sc.nextLine sc "" String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    } int i = 0; int i = 0; i 0 i < str.length i str.length str str.length i++ i++ i {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    } {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    } sb.setLength(0) sb.setLength sb 0 for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      } int j = i; int j = i; j i j < i + str.length j i + str.length i str.length str str.length j++ j++ j {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      } {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      } int a = j; a j if(a >= str.length) {
          a -= str.length;
        } a >= str.length a str.length str str.length {
          a -= str.length;
        } a -= str.length a str.length str str.length sb.append(str[a]) sb.append sb str[a] str a String s = sb.toString(); s sb.toString() sb.toString sb if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      } s.contains(p) s.contains s p {
        System.out.println("Yes");
        break;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(i == str.length - 1) {
        System.out.println("No");
      } i == str.length - 1 i str.length - 1 str.length str str.length 1 {
        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);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
    String[] str = sc.nextLine().split("");
    String p = sc.nextLine();
    for(int i = 0; i < str.length; i++) {
      sb.setLength(0);
      for(int j = i; j < i + str.length; j++) {
        int a = j;
        if(a >= str.length) {
          a -= str.length;
        }
        sb.append(str[a]);
      }
      String s = sb.toString();
      if(s.contains(p)) {
        System.out.println("Yes");
        break;
      } else if(i == str.length - 1) {
        System.out.println("No");
      }
    }
  }
}

