import java.util.*;
 
public class Main {
 	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				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 str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
} Main public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} main {
    	Scanner sc = new Scanner(System.in);
		String str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String ans = sc.next(); ans sc.next() sc.next sc int count = 0; count 0 int max = 0; max 0 LinkedList<String> word = new LinkedList<String>(); word new LinkedList<String>() LinkedList<String> Ans = new LinkedList<String>(); Ans new LinkedList<String>() for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		} int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		} {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		} String str2 = String.valueOf(str.charAt(i)); str2 String.valueOf(str.charAt(i)) String.valueOf String str.charAt(i) str.charAt str i String ans2 = String.valueOf(ans.charAt(i)); ans2 String.valueOf(ans.charAt(i)) String.valueOf String ans.charAt(i) ans.charAt ans i word.add(str2) word.add word str2 Ans.add(ans2) Ans.add Ans ans2 for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		} int i=0; int i=0; i 0 i<str.length() i str.length() str.length str i++ i++ i {
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		} {
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		} word.addFirst(word.getLast()) word.addFirst word word.getLast() word.getLast word word.removeLast() word.removeLast word if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			} word.equals(Ans) word.equals word Ans {
				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 str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				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 str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				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 str = sc.next();
		String ans = sc.next();
		int count = 0;
		int max = 0;
		LinkedList<String> word = new LinkedList<String>();
		LinkedList<String> Ans = new LinkedList<String>();

		for (int i = 0; i < str.length(); i++) {
		    String str2 = String.valueOf(str.charAt(i));
		    String ans2 = String.valueOf(ans.charAt(i));
		    word.add(str2);
		    Ans.add(ans2);
		}
		for(int i=0; i<str.length(); i++){
			word.addFirst(word.getLast());
			word.removeLast();
			if(word.equals(Ans)){
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}
