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

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	}

} Main public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	} main {
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	} InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) String sinput = br.readLine(); sinput br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br String s = sinput + sinput; s sinput + sinput sinput sinput int count = 0; count 0 int index = 0; index 0 for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	} {
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	} if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		} p.charAt(0) == s.charAt(i) p.charAt(0) p.charAt p 0 s.charAt(i) s.charAt s i {
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		} if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			} i + p.length() < s.length() i + p.length() i p.length() p.length p s.length() s.length s {
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			} if (p.equals(s.substring(i, i + p.length() )))
                		count++; p.equals(s.substring(i, i + p.length() )) p.equals p s.substring(i, i + p.length() ) s.substring s i i + p.length() i p.length() p.length p count++ count if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No"); count >= 1 count 1 System.out.println("Yes") System.out.println System.out System System.out "Yes" 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 Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	}

} public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	}

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

public class Main {
	public static void main(String[] args)throws Exception{
		InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);
        
    	String sinput = br.readLine();
    	String p = br.readLine();
    	String s = sinput + sinput;
    	int count = 0;
    	int index = 0;
    	
    	for (int i = 0; i < s.length(); i++)
    	{
    		if (p.charAt(0) == s.charAt(i))
    		{
    			if (i + p.length() < s.length())
    			{
    				if (p.equals(s.substring(i, i + p.length() )))
                		count++;
    			}
    			
    		}
    	}
    	if (count >= 1)
    		System.out.println("Yes");
    	else
    		System.out.println("No");
	}

}