//2019/3/14
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	}

} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	}

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

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	} main {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc String SS = S+S; SS S+S S S boolean flag = false; flag false boolean ans = false; ans false for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		} int i=0; int i=0; i 0 i<S.length() i S.length() S.length S i++ i++ i {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		} {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		} flag = false flag false for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			} int j=0; int j=0; j 0 j<S.length() j S.length() S.length S j++ j++ j {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			} {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			} if(SS.charAt(i+j)!=T.charAt(j)) flag = true; SS.charAt(i+j)!=T.charAt(j) SS.charAt(i+j) SS.charAt SS i+j i j T.charAt(j) T.charAt T j flag = true flag true if(!flag) ans = true; !flag flag ans = true ans true if(ans)System.out.println("Yes");

		else System.out.println("No"); ans System.out.println("Yes") System.out.println System.out System System.out "Yes" 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) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	}

} Main
//2019/3/14
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String S = sc.next();

		String T = sc.next();

		String SS = S+S;

		boolean flag = false;

		boolean ans = false;

		//はじめの文字
		for(int i=0;i<S.length();i++) {

			flag = false;

			for(int j=0;j<S.length();j++) {

				if(SS.charAt(i+j)!=T.charAt(j)) flag = true;
			}

			if(!flag) ans = true;
		}

		if(ans)System.out.println("Yes");

		else System.out.println("No");
	}

}
