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

public class Main {
	public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	}
} Main public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	} main {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	} try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		} catch(IOException e){
			System.err.println(e);
		} IOException e {
			System.err.println(e);
		} System.err.println(e) System.err.println System.err System System.err e {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String str = br.readLine(); str br.readLine() br.readLine br String result = br.readLine(); result br.readLine() br.readLine br int slen = str.length(); slen str.length() str.length str int rlen = result.length(); rlen result.length() result.length result int j = 0; j 0 for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			} int i = 0; int i = 0; i 0 i < slen i slen i++ i++ i {
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			} {
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			} if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				} str.charAt(i) == result.charAt(0) str.charAt(i) str.charAt str i result.charAt(0) result.charAt result 0 {
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				} int count = i; count i for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					} j = 0; j = 0 j 0 j < rlen j rlen j++ j++ j {
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					} {
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					} count = (i + j) % slen count (i + j) % slen (i + j) i j slen if(str.charAt(count) != result.charAt(j)){
							break;
						} str.charAt(count) != result.charAt(j) str.charAt(count) str.charAt str count result.charAt(j) result.charAt result j {
							break;
						} break; if(rlen == j){
					break;
				} rlen == j rlen j {
					break;
				} break; if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			} rlen == j rlen j {
				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 public class Main {
	public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	}
} public class Main {
	public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args)throws IOException{
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			String result = br.readLine();

			int slen = str.length();
			int rlen = result.length();
			int j = 0;
			for(int i = 0; i < slen; i++){
				if(str.charAt(i) == result.charAt(0)){
					int count = i;
					for(j = 0; j < rlen; j++){
						count = (i + j) % slen;
						if(str.charAt(count) != result.charAt(j)){
							break;
						}
					}
				}
				if(rlen == j){
					break;
				}
			}
			if(rlen == j){
				System.out.println("Yes");
			}else{
				System.out.println("No");
			}

		}catch(IOException e){
			System.err.println(e);
		}
	}
}