import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} Main public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	} main {

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String x = sc.nextLine(); x sc.nextLine() sc.nextLine sc x += x x x String y = sc.nextLine(); y sc.nextLine() sc.nextLine sc if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} x.contains(y) x.contains x y {
			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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
} Main
import java.io.IOException;
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws IOException{

		Scanner sc = new Scanner(System.in);

		String x = sc.nextLine();
		x += x;
		String y = sc.nextLine();

		if(x.contains(y)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

		sc.close();
	}
}
