import java.io.*;

public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} import java.io.*; io.* java public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} Main public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br StringBuffer sb = new StringBuffer(); sb new StringBuffer() int i = 0; i 0 int j = 0; j 0 int x = 0; x 0 for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		} i=0 ; i=0 i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		} {
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		} if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			} (i+p.length())>s.length() (i+p.length()) i p.length() p.length p s.length() s.length s {
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			} x = (i+p.length())-s.length() x (i+p.length())-s.length() (i+p.length()) i p.length() p.length p s.length() s.length s sb.append(s.substring(i, s.length())).append(s.substring(0, x)) sb.append(s.substring(i, s.length())).append sb.append(s.substring(i, s.length())) sb.append sb s.substring(i, s.length()) s.substring s i s.length() s.length s s.substring(0, x) s.substring s 0 x {
				sb.append(s.substring(i, i+p.length()));
			} sb.append(s.substring(i, i+p.length())) sb.append sb s.substring(i, i+p.length()) s.substring s i i+p.length() i p.length() p.length p if( sb.toString().equals(p) ){
				j++;
				break;
			} sb.toString().equals(p) sb.toString().equals sb.toString() sb.toString sb p {
				j++;
				break;
			} j++ j break; sb.setLength(0) sb.setLength sb 0 if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		} j==0 j 0 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] age age public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
} Main
import java.io.*;

public class Main {
	public static void main(String[] age)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		StringBuffer sb = new StringBuffer();
		int i = 0;
		int j = 0;
		int x = 0;

		for( i=0 ; i<s.length() ; i++ ){
			if ( (i+p.length())>s.length() ){
				x = (i+p.length())-s.length();
				sb.append(s.substring(i, s.length())).append(s.substring(0, x));
			}else{
				sb.append(s.substring(i, i+p.length()));
			}
			if( sb.toString().equals(p) ){
				j++;
				break;
			}
			sb.setLength(0);
		}

		if( j==0){
			System.out.println("No");
		}else{
			System.out.println("Yes");
		}
	}
}