import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
} Main public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	} main {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	} String DNA DNA RNA; RNA try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		} {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) DNA = sc.nextLine() DNA sc.nextLine() sc.nextLine sc RNA = sc.nextLine() RNA sc.nextLine() sc.nextLine sc DNA = DNA + DNA DNA DNA + DNA DNA DNA if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			} DNA.indexOf(RNA) == -1 DNA.indexOf(RNA) DNA.indexOf DNA RNA -1 1 {
				System.out.println("No");
			} System.out.println("No") System.out.println System.out System System.out "No" {
				System.out.println("Yes");
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
} public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		String DNA, RNA;
		try (Scanner sc = new Scanner(System.in)) {
			DNA = sc.nextLine();
			RNA = sc.nextLine();
			DNA = DNA + DNA;
			if(DNA.indexOf(RNA) == -1) {
				System.out.println("No");
			}else {
				System.out.println("Yes");
			}
			
		}
	}
}
