import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
} Main public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	} main {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) StringBuilder s s t; t s= new StringBuilder(sc.next()) s new StringBuilder(sc.next()) t=new StringBuilder(sc.next()) t new StringBuilder(sc.next()) boolean flag=false; flag false for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		} {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		} s=new StringBuilder(Rotate(s)) s new StringBuilder(Rotate(s)) if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			} t.toString().equals(s.toString()) t.toString().equals t.toString() t.toString t s.toString() s.toString s {
				flag=true;
				break;
			} flag=true flag true break; if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No"); flag==true flag true System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	} Rotate {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	} int len=str.length(); len str.length() str.length str char t=str.charAt(0); t str.charAt(0) str.charAt str 0 for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		} int i=0; int i=0; i 0 i<len-1 i len-1 len 1 i++ i++ i {
			str.setCharAt(i,str.charAt(i+1));			
		} {
			str.setCharAt(i,str.charAt(i+1));			
		} str.setCharAt(i,str.charAt(i+1)) str.setCharAt str i str.charAt(i+1) str.charAt str i+1 i 1 str.setCharAt(len-1,t) str.setCharAt str len-1 len 1 t return str; str StringBuilder str str public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		StringBuilder s,t;
		s= new StringBuilder(sc.next());
		t=new StringBuilder(sc.next());
		boolean flag=false;
		for(int i=0;i<s.length();i++) {
			s=new StringBuilder(Rotate(s));
			if(t.toString().equals(s.toString())) {
				flag=true;
				break;
			}
		}
		if(flag==true)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
	
	public static StringBuilder Rotate(StringBuilder str) {
		int len=str.length();
		char t=str.charAt(0);
		for(int i=0;i<len-1;i++) {
			str.setCharAt(i,str.charAt(i+1));			
		}
		str.setCharAt(len-1,t);
		return str;
	}
}