import java.io.*;

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

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