

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -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) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	}
} Main public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	} main {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) String str1 = in.next(); str1 in.next() in.next in String str2 = in.next(); str2 in.next() in.next in String ring_str = str1 + str1; ring_str str1 + str1 str1 str1 int result = ring_str.indexOf(str2); result ring_str.indexOf(str2) ring_str.indexOf ring_str str2 if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		} result == -1 result -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) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	}
} public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	}
} Main


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);

		String str1 = in.next();
		String str2 = in.next();

		String ring_str = str1 + str1;

		//System.out.println(ring_str);

		int result = ring_str.indexOf(str2);

		if(result == -1){

			System.out.println("No");

		}else{

			System.out.println("Yes");

		}
	}
}