import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	}
} Main public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	} main {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	} Scanner scan=new Scanner(System.in); scan new Scanner(System.in) String s=scan.next(); s scan.next() scan.next scan String p=scan.next(); p scan.next() scan.next scan boolean signal=true; signal true for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		} {
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		} signal=true signal true for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			} int j=0; int j=0; j 0 j<p.length() j p.length() p.length p j++ j++ j {
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			} {
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			} if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				} s.charAt((i+j)%s.length())!=p.charAt(j) s.charAt((i+j)%s.length()) s.charAt s (i+j)%s.length() (i+j) i j s.length() s.length s p.charAt(j) p.charAt p j {
					signal=false;
					break;
				} signal=false signal false break; if(signal){
				break;
			} signal {
				break;
			} break; if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} signal {
			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" scan.close() scan.close scan String[] args args public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	}
} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		
		String s=scan.next();
		String p=scan.next();
		boolean signal=true;
		
		for(int i=0;i<s.length();i++){
			signal=true;
			for(int j=0;j<p.length();j++){
				if(s.charAt((i+j)%s.length())!=p.charAt(j)){
					signal=false;
					break;
				}
			}
			if(signal){
				break;
			}
		}
		if(signal){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
		scan.close();
	}
}