import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	}
} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	} main {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) String p = scanner.nextLine(); p scanner.nextLine() scanner.nextLine scanner String _p = p+p; _p p+p p p String s = scanner.nextLine(); s scanner.nextLine() scanner.nextLine scanner if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} _p.contains(s) _p.contains _p s {
			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" scanner.close() scanner.close scanner String[] args args public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	}
} public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String p = scanner.nextLine();	//vanceknowledgetoad
		String _p = p+p;				//vanceknowledgetoadvanceknowledgetoad
		String s = scanner.nextLine();	//advance
		if (_p.contains(s)) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
		scanner.close();
	}
}
