import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	}

	private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	}

}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	}

	private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	}

} Main public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s  = sc.next(); s sc.next() sc.next sc String p  = sc.next(); p sc.next() sc.next sc sc.close() sc.close sc boolean answer = computeRingPattern(s,p); answer computeRingPattern(s,p) computeRingPattern s p if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} answer {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	} computeRingPattern {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	} char[] strings = new char[s.length()+p.length()]; strings new char[s.length()+p.length()] s.length()+p.length() s.length() s.length s p.length() p.length p for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		} int i= 0; int i= 0; i 0 i< s.length() +p.length() i s.length() +p.length() s.length() s.length s p.length() p.length p i++ i++ i {
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		} {
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		} if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			} i < s.length() i s.length() s.length s {
				
				strings[i] = s.charAt(i);
			} strings[i] = s.charAt(i) strings[i] strings i s.charAt(i) s.charAt s i {
				
				strings[i] = s.charAt(i -s.length());
				
			} strings[i] = s.charAt(i -s.length()) strings[i] strings i s.charAt(i -s.length()) s.charAt s i -s.length() i s.length() s.length s for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		} int i = 0; int i = 0; i 0 i<strings.length -p.length() +1 i strings.length -p.length() +1 strings.length -p.length() strings.length strings strings.length p.length() p.length p 1 i++ i++ i {
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		} {
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		} for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			} int j =0; int j =0; j 0 j<p.length() j p.length() p.length p j++ j++ j {
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			} {
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			} if(strings[i+j] != p.charAt(j)){
					
					break;
				} strings[i+j] != p.charAt(j) strings[i+j] strings i+j i j p.charAt(j) p.charAt p j {
					
					break;
				} break; if((j + 1) == p.length()){
					return true;
				} (j + 1) == p.length() (j + 1) j 1 p.length() p.length p {
					return true;
				} return true; true return false; false String s s String p p public class Main {

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	}

	private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	}

} public class Main {

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	}

	private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		String s  = sc.next();
		String p  = sc.next();
		
		sc.close();
		
		boolean answer = computeRingPattern(s,p);
		
		if(answer){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		
	}

	private static boolean computeRingPattern(String s, String p) {
		
		char[] strings = new char[s.length()+p.length()];
		
		for(int i= 0; i< s.length() +p.length();i++){
			
			if(i < s.length()){
				
				strings[i] = s.charAt(i);
			}else{
				
				strings[i] = s.charAt(i -s.length());
				
			}
			
		}
		
		for(int i = 0; i<strings.length -p.length() +1 ;i++){
			
			for(int j =0; j<p.length();j++){
				
				
				if(strings[i+j] != p.charAt(j)){
					
					break;
				}
				
				if((j + 1) == p.length()){
					return true;
				}
				
			}
			
			
		}
		
		
		return false;
	}

}

