import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    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 strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String strS[] = sc.next().split(""); strS sc.next().split("") sc.next().split sc.next() sc.next sc "" String strT[] = sc.next().split(""); strT sc.next().split("") sc.next().split sc.next() sc.next sc "" for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    } int i=strS.length-1; int i=strS.length-1; i strS.length-1 strS.length strS strS.length 1 i >= 0 i 0 i-- i-- i {
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    } {
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    } String tmp = strS[strS.length-1]; tmp strS[strS.length-1] strS strS.length-1 strS.length strS strS.length 1 for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        } int j=strS.length-1; int j=strS.length-1; j strS.length-1 strS.length strS strS.length 1 j > 0 j 0 j-- j-- j {
            strS[j] = strS[j-1];
        } {
            strS[j] = strS[j-1];
        } strS[j] = strS[j-1] strS[j] strS j strS[j-1] strS j-1 j 1 strS[0] = tmp strS[0] strS 0 tmp if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        } Arrays.equals(strS,strT) Arrays.equals Arrays strS strT {
            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 public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  }
} Main
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String strS[] = sc.next().split("");
    String strT[] = sc.next().split("");
    for (int i=strS.length-1; i >= 0 ; i--){
        String tmp = strS[strS.length-1];
        for (int j=strS.length-1; j > 0 ; j--){
            strS[j] = strS[j-1];
        }
        strS[0] = tmp;
        if(Arrays.equals(strS,strT)){
            System.out.println("Yes");
            return;
        }        
    }
    System.out.println("No");
  }
}