import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("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.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} main {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.nextLine(); S sc.nextLine() sc.nextLine sc String T = sc.nextLine(); T sc.nextLine() sc.nextLine sc boolean can = false; can false for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		} int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S i++ i++ i {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		} {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		} S = S + S.charAt(0) S S + S.charAt(0) S S.charAt(0) S.charAt S 0 S = S.substring(1) S S.substring(1) S.substring S 1 if(S.equals(T)) {
					can = true;
					break;
				} S.equals(T) S.equals S T {
					can = true;
					break;
				} can = true can true break; if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} can == true can true {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} 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 sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.nextLine();
		String T = sc.nextLine();
		boolean can = false;

		for(int i = 0;i < S.length();i++) {
			S = S + S.charAt(0);
			S = S.substring(1);
				if(S.equals(T)) {
					can = true;
					break;
				}
		}
		if(can == true) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}
