import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			}

	}


	 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			}

	} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			} main {
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String x = scan.next(); x scan.next() scan.next scan String y = scan.next(); y scan.next() scan.next scan String[] ya = y.split(""); ya y.split("") y.split y "" String a = x + x; a x + x x x String[] aa = a.split(""); aa a.split("") a.split a "" int len = aa.length - ya.length; len aa.length - ya.length aa.length aa aa.length ya.length ya ya.length int i i m m t; t t = 0 t 0 for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			} i = 0; i = 0 i 0 i < len i len i++ i++ i {
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			} {
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			} t = 0 t 0 for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			} m = 0; m = 0 m 0 m < y.length() m y.length() y.length y m++ m++ m {
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			} {
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			} if(aa[i + m].equals(ya[m])){
					++t;
				} aa[i + m].equals(ya[m]) aa[i + m].equals aa[i + m] aa i + m i m ya[m] ya m {
					++t;
				} ++t t if(t == y.length()){
					System.out.println("Yes");
					break;
				} t == y.length() t y.length() y.length y {
					System.out.println("Yes");
					break;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(t != y.length())
			System.out.println("No"); t != y.length() t y.length() y.length y 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){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			}

	} public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			}

	} Main
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		String x = scan.next();
		String y = scan.next();
		String[] ya = y.split("");
		String a = x + x;
		String[] aa = a.split("");
		int len = aa.length - ya.length;
		int i,m,t;
		t = 0;
		for(i = 0; i < len; i++){
			t = 0;
			for(m = 0; m < y.length(); m++){
				if(aa[i + m].equals(ya[m])){
					++t;
				}
			}
				if(t == y.length()){
					System.out.println("Yes");
					break;
				}
				
			
			}
		if(t != y.length())
			System.out.println("No");
 			}

	}


	