
import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	}
} import java.util.Iterator; Iterator java.util import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	}
} Main public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	} main {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.next(); s scan.next() scan.next scan String t = scan.next(); t scan.next() scan.next scan String ans = "No"; ans "No" for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		} {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		} s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1) s s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1) s.substring(s.length() - 1, s.length()) s.substring s s.length() - 1 s.length() s.length s 1 s.length() s.length s s.substring(0, s.length() - 1) s.substring s 0 s.length() - 1 s.length() s.length s 1 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 scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	}
} public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	}
} Main

import java.util.Iterator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		
		String ans = "No";
		for (int i = 0; i < s.length(); i++) {
			s = s.substring(s.length() - 1, s.length()) + s.substring(0, s.length() - 1); 
			
			if (s.equals(t)) {
				ans = "Yes";
				break;
			}
		}
		
		System.out.println(ans);
		
	}
}