import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}
} import java.util.Scanner; Scanner java.util public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}
} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	} main {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		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 int len = s.length(); len s.length() s.length s for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < len i len i++ i++ i {
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		} {
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		} String s1 = s.substring(0, i); s1 s.substring(0, i) s.substring s 0 i String s2 = s.substring(i, len); s2 s.substring(i, len) s.substring s i len String rot = s2 + s1; rot s2 + s1 s2 s1 if(rot.equals(t)){
				System.out.println("Yes");
				return;
			} rot.equals(t) rot.equals rot t {
				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 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}
} public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}
} Main
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		String t = sc.next();
		
		int len = s.length();
		
		for(int i = 0; i < len; i++){
			String s1 = s.substring(0, i);
			String s2 = s.substring(i, len);
			
			String rot = s2 + s1;
			
//			System.out.println(s2+" + "+s1+ " = "+rot);
			if(rot.equals(t)){
				System.out.println("Yes");
				return;
			}
		}
		
		System.out.println("No");
	}
}
