import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main InputStream in = System.in; in System.in System System.in PrintStream out = System.out; out System.out System System.out public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	} _main {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	} Scanner sc = new Scanner(in); sc new Scanner(in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc sc.close() sc.close sc String ans = "No"; ans "No" for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		} int i=0; int i=0; i 0 i<T.length() i T.length() T.length T i++ i++ i {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		} {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		} String newT = T.substring(i)  + T.substring(0,i); newT T.substring(i)  + T.substring(0,i) T.substring(i) T.substring T i T.substring(0,i) T.substring T 0 i if(S.equals(newT)) {
				ans = "Yes";
				break;
			} S.equals(newT) S.equals S newT {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; out.println(ans) out.println out ans String[] args args public static void main(String[] args) {
		new Main()._main(args);
	} main {
		new Main()._main(args);
	} new Main()._main(args) new Main()._main new Main() args String[] args args public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {
	InputStream in = System.in;
	PrintStream out = System.out;

	public void _main(String[] args) {
		Scanner sc = new Scanner(in);

		String S = sc.next();
		String T = sc.next();
		sc.close();
		
		String ans = "No";
		for(int i=0;i<T.length();i++) {
			String newT = T.substring(i)  + T.substring(0,i);
			if(S.equals(newT)) {
				ans = "Yes";
				break;
			}
		}
		out.println(ans);

	}

	public static void main(String[] args) {
		new Main()._main(args);
	}

}
