
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main{

	public static void main(String[] args) throws IOException {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.ArrayList; ArrayList java.util import java.util.Arrays; Arrays java.util import java.util.List; List java.util public class Main{

	public static void main(String[] args) throws IOException {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	}
} Main public static void main(String[] args) throws IOException {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	} main {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) char[] n    = br.readLine().toCharArray(); n br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br char[] tmp  = br.readLine().toCharArray(); tmp br.readLine().toCharArray() br.readLine().toCharArray br.readLine() br.readLine br for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		} int i = 0; int i = 0; i 0 i < n.length i n.length n n.length i++ i++ i {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		} {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		} int now = i; now i boolean flg = true; flg true for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			} int j = 0; int j = 0; j 0 j < n.length j n.length n n.length j ++ j ++ j {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			} {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			} if(now >=  n.length) {
					now = 0;
				} now >=  n.length now n.length n n.length {
					now = 0;
				} now = 0 now 0 if(tmp[now] != n[j]) {
					flg  = false;
					break;
				} tmp[now] != n[j] tmp[now] tmp now n[j] n j {
					flg  = false;
					break;
				} flg  = false flg false break; now++ now if(flg) {

				System.out.println("Yes");
				return;
			} flg {

				System.out.println("Yes");
				return;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; 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 {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	}
} public class Main{

	public static void main(String[] args) throws IOException {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	}
} Main

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main{

	public static void main(String[] args) throws IOException {

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

		char[] n    = br.readLine().toCharArray();
		char[] tmp  = br.readLine().toCharArray();

		for(int i = 0; i < n.length; i++) {

			int now = i;
			boolean flg = true;
			for(int j = 0; j < n.length; j ++) {

				if(now >=  n.length) {
					now = 0;
				}
				if(tmp[now] != n[j]) {
					flg  = false;
					break;
				}

				now++;
			}

			if(flg) {

				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");

	}
}
