import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String ans = "No"; ans "No" ArrayList<String> sList = new ArrayList<>(); sList new ArrayList<>() sList.addAll(Arrays.asList(sc.next().split(""))) sList.addAll sList Arrays.asList(sc.next().split("")) Arrays.asList Arrays sc.next().split("") sc.next().split sc.next() sc.next sc "" String t = sc.next(); t sc.next() sc.next sc for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        } int i = 0; int i = 0; i 0 i < sList.size() i sList.size() sList.size sList i++ i++ i {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        } {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        } String value = sList.get(0); value sList.get(0) sList.get sList 0 sList.remove(0) sList.remove sList 0 sList.add(value) sList.add sList value StringBuilder builder = new StringBuilder(); builder new StringBuilder() for(String s : sList) {
            builder.append(s);
          } String s sList {
            builder.append(s);
          } {
            builder.append(s);
          } builder.append(s) builder.append builder s String s = builder.toString(); s builder.toString() builder.toString builder if (s.equals(t)) {
            ans = "Yes";
            break;
          } s.equals(t) s.equals s t {
            ans = "Yes";
            break;
          } ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
} Main
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        String ans = "No";
    
		// 文字列の入力
        ArrayList<String> sList = new ArrayList<>();
        sList.addAll(Arrays.asList(sc.next().split("")));
        String t = sc.next();
      
        for(int i = 0; i < sList.size(); i++) {
          String value = sList.get(0);
          sList.remove(0);
          sList.add(value);
          StringBuilder builder = new StringBuilder();
          for(String s : sList) {
            builder.append(s);
          }
          String s = builder.toString();
          if (s.equals(t)) {
            ans = "Yes";
            break;
          }
        }
    
		// 出力
		System.out.println(ans);
	}
}