import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	}
	
}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	}
	
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) StringBuilder stb = new StringBuilder(); stb new StringBuilder() stb.append(sc.next()) stb.append stb sc.next() sc.next sc stb.append(stb) stb.append stb stb String str= stb.toString(); str stb.toString() stb.toString stb String x = sc.next(); x sc.next() sc.next sc System.out.println(str.contains(x) ? "Yes" : "No") System.out.println System.out System System.out str.contains(x) ? "Yes" : "No" str.contains(x) str.contains str x "Yes" "No" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	}
	
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	}
	
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder stb = new StringBuilder();
		stb.append(sc.next());
		stb.append(stb);
		String str= stb.toString();
		String x = sc.next();
		System.out.println(str.contains(x) ? "Yes" : "No");
		sc.close();
	}
	
}

