import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	}
} import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc List<String> list= new ArrayList<String>(Arrays.asList(s.split(""))); list new ArrayList<String>(Arrays.asList(s.split(""))) if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		} s.equals(t) s.equals s t System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		} for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			} int i=0; int i=0; i 0 list.size()>i list.size() list.size list i i++ i++ i {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			} {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			} String answer = ""; answer "" String last = list.get(list.size()-1); last list.get(list.size()-1) list.get list list.size()-1 list.size() list.size list 1 for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				} int j=list.size()-1; int j=list.size()-1; j list.size()-1 list.size() list.size list 1 -1<j -1 1 j j-- j-- j {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				} {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				} if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last); j!=0 j 0 {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					} String m = list.get(j-1); m list.get(j-1) list.get list j-1 j 1 list.set(j, m) list.set list j m list.set(0, last) list.set list 0 last for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				} int j=0; int j=0; j 0 list.size()>j list.size() list.size list j j++ j++ j {
					answer=answer+list.get(j);
				} {
					answer=answer+list.get(j);
				} answer=answer+list.get(j) answer answer+list.get(j) answer list.get(j) list.get list j if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				} answer.equals(t) answer.equals answer t {
					System.out.println("Yes");
					System.exit(0);
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" System.exit(0) System.exit System 0 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);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	}
} Main
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		String s = sc.next();
		String t = sc.next();
		List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		if(s.equals(t))
			System.out.println("Yes");
		else {
			for(int i=0;list.size()>i;i++) {
				String answer = "";
				String last = list.get(list.size()-1);
				for(int j=list.size()-1;-1<j;j--) {
					if(j!=0) {
						String m = list.get(j-1);
						//System.out.println(m);
						list.set(j, m);
					}
					else
						list.set(0, last);
				}
				for(int j=0;list.size()>j;j++) {
					answer=answer+list.get(j);
				}
				//System.out.println(answer);
				if(answer.equals(t)) {
					System.out.println("Yes");
					System.exit(0);
				}
			}
			System.out.println("No");
		}
	}
}