import java.util.Scanner;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String strs = sc.next();
    String strp = sc.next();
    int snum = strs.length();
    int psum = strp.length();
    
    for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        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 strs = sc.next();
    String strp = sc.next();
    int snum = strs.length();
    int psum = strp.length();
    
    for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    }
  }
} Main public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String strs = sc.next();
    String strp = sc.next();
    int snum = strs.length();
    int psum = strp.length();
    
    for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    }
  } main {
    Scanner sc = new Scanner(System.in);
    String strs = sc.next();
    String strp = sc.next();
    int snum = strs.length();
    int psum = strp.length();
    
    for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String strs = sc.next(); strs sc.next() sc.next sc String strp = sc.next(); strp sc.next() sc.next sc int snum = strs.length(); snum strs.length() strs.length strs int psum = strp.length(); psum strp.length() strp.length strp for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    } int p = 0; int p = 0; p 0 p < snum p snum p++ p++ p {
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    } {
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    } String str1 = ""; str1 "" String str2 = ""; str2 "" String str3 = ""; str3 "" for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      } int q = p; int q = p; q p q < snum q snum q++ q++ q {
        char c1 = strs.charAt(q);
        str1 += c1;
      } {
        char c1 = strs.charAt(q);
        str1 += c1;
      } char c1 = strs.charAt(q); c1 strs.charAt(q) strs.charAt strs q str1 += c1 str1 c1 for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      } int r = 0; int r = 0; r 0 r < p r p r++ r++ r {
        char c2 = strs.charAt(r);
        str2 += c2;
      } {
        char c2 = strs.charAt(r);
        str2 += c2;
      } char c2 = strs.charAt(r); c2 strs.charAt(r) strs.charAt strs r str2 += c2 str2 c2 for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      } int s = 0; int s = 0; s 0 s < psum s psum s++ s++ s {
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      } {
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      } char c3 = (str1+str2).charAt(s); c3 (str1+str2).charAt(s) (str1+str2).charAt (str1+str2) str1 str2 s str3 += c3 str3 c3 if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      } str3.equals(strp) str3.equals str3 strp {
        System.out.println("Yes");
        break;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(p == snum-1){
        System.out.println("No");
      } p == snum-1 p snum-1 snum 1 {
        System.out.println("No");
      } 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 strs = sc.next();
    String strp = sc.next();
    int snum = strs.length();
    int psum = strp.length();
    
    for(int p = 0; p < snum; p++){
      String str1 = "";
      String str2 = "";
      String str3 = "";
      for(int q = p; q < snum; q++){
        char c1 = strs.charAt(q);
        str1 += c1;
      }
      for(int r = 0; r < p; r++){
        char c2 = strs.charAt(r);
        str2 += c2;
      }
      for(int s = 0; s < psum; s++){
        char c3 = (str1+str2).charAt(s);
        str3 += c3;
      }
      
      if(str3.equals(strp)){
        System.out.println("Yes");
        break;
      }else if(p == snum-1){
        System.out.println("No");
      }
    }
  }
}
