import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws IOException {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	}

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

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	} main {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	} String s s t; t int length; length BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) s = br.readLine() s br.readLine() br.readLine br t = br.readLine() t br.readLine() br.readLine br length = s.length() length s.length() s.length s if(s.equals(t)) {
			System.out.println("Yes");
			return;
		} s.equals(t) s.equals s t {
			System.out.println("Yes");
			return;
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		} int i=0; int i=0; i 0 i<length i length i++ i++ i {
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		} {
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		} char s_part = s.charAt(length-1); s_part s.charAt(length-1) s.charAt s length-1 length 1 s = s.substring(0, length-1) s s.substring(0, length-1) s.substring s 0 length-1 length 1 s = s_part + s s s_part + s s_part s if(s.equals(t)) {
			System.out.println("Yes");
			return;
		} s.equals(t) s.equals s t {
			System.out.println("Yes");
			return;
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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) throws IOException {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) throws IOException {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {

		String s,t;
		int length;

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		s = br.readLine();
		t = br.readLine();

		length = s.length();

		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}

		for(int i=0;i<length;i++){
		char s_part = s.charAt(length-1);
		s = s.substring(0, length-1);
		s = s_part + s;
		if(s.equals(t)) {
			System.out.println("Yes");
			return;
		}
		}
		System.out.println("No");
	}

}
