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

// (1) ?????????s???????????????
// (2) ?????????p???????????????
// (3) ?????????s?????????????????????sMatrix?????¨?????????
// (4) ?????????p?????????????????????pMatrix?????¨?????????
// (5) ?????????s???????????°?????????1??????????????\?????????????????????
	// (5.1) ????±???¨??????1?????????Char??????????????????
	// (5.2) ????????????????????§????????????????¢????????????´????????\?????????????????????
		// (5.2.1) ?????????????????????
	// (5.3) ?????????p???????????°?????????1??????????????\?????????????????????
		// (5.3.1) ????±???¨??????1?????????Char??????????????????
		// (5.3.2)

// ????????°????????£??????????????´???

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
} 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 {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	} 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 int sLen = s.length(); sLen s.length() s.length s int pLen = p.length(); pLen p.length() p.length p boolean foundP = false; foundP false for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		} int i = 0; int i = 0; i 0 i < sLen i sLen i++ i++ i {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		} {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		} for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			} int j = 0; int j = 0; j 0 j < pLen j pLen j++ j++ j {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			} {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			} int k = (i + j) % sLen; k (i + j) % sLen (i + j) i j sLen char sc = s.charAt(k); sc s.charAt(k) s.charAt s k char pc = p.charAt(j); pc p.charAt(j) p.charAt p j if(sc != pc) {
					break;
				} sc != pc sc pc {
					break;
				} break; if(j == pLen-1) {
					foundP = true;
					break;
				} j == pLen-1 j pLen-1 pLen 1 {
					foundP = true;
					break;
				} foundP = true foundP true break; if(foundP) {
				break;
			} foundP {
				break;
			} break; if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} foundP {
			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" br.close() br.close br String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

// (1) ?????????s???????????????
// (2) ?????????p???????????????
// (3) ?????????s?????????????????????sMatrix?????¨?????????
// (4) ?????????p?????????????????????pMatrix?????¨?????????
// (5) ?????????s???????????°?????????1??????????????\?????????????????????
	// (5.1) ????±???¨??????1?????????Char??????????????????
	// (5.2) ????????????????????§????????????????¢????????????´????????\?????????????????????
		// (5.2.1) ?????????????????????
	// (5.3) ?????????p???????????°?????????1??????????????\?????????????????????
		// (5.3.1) ????±???¨??????1?????????Char??????????????????
		// (5.3.2)

// ????????°????????£??????????????´???

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		String p = br.readLine();
		int sLen = s.length();
		int pLen = p.length();

		boolean foundP = false;

		for(int i = 0; i < sLen; i++) {

			for(int j = 0; j < pLen; j++) {
				int k = (i + j) % sLen;
				char sc = s.charAt(k);
				char pc = p.charAt(j);

				if(sc != pc) {
					break;
				}

				if(j == pLen-1) {
					foundP = true;
					break;
				}
			}

			if(foundP) {
				break;
			}
		}

		if(foundP) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		br.close();
	}
}