import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	} main {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String s = scanner.next(); s scanner.next() scanner.next scanner String t = scanner.next(); t scanner.next() scanner.next scanner int start = 0; start 0 while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		} true {
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		} int idx = s.indexOf(t.substring(0, 1), start); idx s.indexOf(t.substring(0, 1), start) s.indexOf s t.substring(0, 1) t.substring t 0 1 start if(idx==-1) break; idx==-1 idx -1 1 break; start=idx+1 start idx+1 idx 1 if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			} t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx)) t.endsWith(s.substring(0, idx)) t.endsWith t s.substring(0, idx) s.substring s 0 idx t.startsWith(s.substring(idx)) t.startsWith t s.substring(idx) s.substring s idx {
				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 scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();

		int start = 0;
		while (true){
			int idx = s.indexOf(t.substring(0, 1), start);
			if(idx==-1) break;
			start=idx+1;
			if(t.endsWith(s.substring(0, idx)) && t.startsWith(s.substring(idx))) {
				System.out.println("Yes");
				System.exit(0);
			}
		}
		System.out.println("No");

	}
}