import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "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 boolean b = false; b false for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i)); int i = 0; int i = 0; i 0 i < s.length() && !b i < s.length() i s.length() s.length s !b b i++ i++ i b |= s.equals(t.substring(i, s.length()) + t.substring(0,i)); b |= s.equals(t.substring(i, s.length()) + t.substring(0,i)) b s.equals(t.substring(i, s.length()) + t.substring(0,i)) s.equals s t.substring(i, s.length()) + t.substring(0,i) t.substring(i, s.length()) t.substring t i s.length() s.length s t.substring(0,i) t.substring t 0 i System.out.println(b ? "Yes" : "No") System.out.println System.out System System.out b ? "Yes" : "No" b "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		boolean b = false;
		for(int i = 0; i < s.length() && !b; i++)
			b |= s.equals(t.substring(i, s.length()) + t.substring(0,i));
		System.out.println(b ? "Yes" : "No");
	}
}