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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	}
} import java.io.InputStreamReader; InputStreamReader java.io import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br String ring = s + s; ring s + s s s if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes"); ring.indexOf(p) == -1 ring.indexOf(p) ring.indexOf ring p -1 1 System.out.println("No") System.out.println System.out System System.out "No" 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) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	}
} Main
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		String ring = s + s;
		if (ring.indexOf(p) == -1) System.out.println("No");
		else System.out.println("Yes");
	}
}