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

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	}
} 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 final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	}
} Main public static final int BIG_NUM  = 2000000000; BIG_NUM 2000000000 public static final int MOD  = 1000000007; MOD 1000000007 public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	} main {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} String T = br.readLine(); T br.readLine() br.readLine br String P = br.readLine(); P br.readLine() br.readLine br if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			} P.length() <= T.length() P.length() P.length P T.length() T.length T {

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			} char T_array[] = T.toCharArray(); T_array T.toCharArray() T.toCharArray T char P_array[] = P.toCharArray(); P_array P.toCharArray() P.toCharArray P boolean Found = false Found false FLG; FLG for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				} int start = 0; int start = 0; start 0 start < T.length() start T.length() T.length T start++ start++ start {
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				} {
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				} FLG = true FLG true for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					} int i = 0; int i = 0; i 0 i < P.length() i P.length() P.length P i++ i++ i {
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					} {
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					} if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						} P_array[i] != T_array[(start+i)%T.length()] P_array[i] P_array i T_array[(start+i)%T.length()] T_array (start+i)%T.length() (start+i) start i T.length() T.length T {
							FLG = false;
							break;
						} FLG = false FLG false break; if(FLG){
						Found = true;
						break;
					} FLG {
						Found = true;
						break;
					} Found = true Found true break; if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				} Found {
					System.out.printf("Yes\n");
				} System.out.printf("Yes\n") System.out.printf System.out System System.out "Yes\n" {
					System.out.printf("No\n");
				} System.out.printf("No\n") System.out.printf System.out System System.out "No\n" {

				System.out.printf("No\n");
			} System.out.printf("No\n") System.out.printf System.out System System.out "No\n" String[] args args public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	}
} public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


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

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		try {
			String T = br.readLine();
			String P = br.readLine();

			if(P.length() <= T.length()){

				char T_array[] = T.toCharArray();
				char P_array[] = P.toCharArray();

				boolean Found = false,FLG;

				for(int start = 0; start < T.length(); start++){
					FLG = true;
					for(int i = 0; i < P.length(); i++){
						if(P_array[i] != T_array[(start+i)%T.length()]){
							FLG = false;
							break;
						}
					}
					if(FLG){
						Found = true;
						break;
					}
				}

				if(Found){
					System.out.printf("Yes\n");
				}else{
					System.out.printf("No\n");
				}

			}else{

				System.out.printf("No\n");
			}

		} catch (IOException e) {
			e.printStackTrace();
		}


	}
}
