import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} import java.io.*; io.* java public class Main {
	public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} main {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	} String inputString inputString phrase; phrase InputStreamReader reader = new InputStreamReader(System.in); reader new InputStreamReader(System.in) BufferedReader bufferdReader = new BufferedReader(reader); bufferdReader new BufferedReader(reader) inputString = bufferdReader.readLine() inputString bufferdReader.readLine() bufferdReader.readLine bufferdReader inputString = inputString + inputString inputString inputString + inputString inputString inputString phrase = bufferdReader.readLine() phrase bufferdReader.readLine() bufferdReader.readLine bufferdReader if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		} inputString.indexOf(phrase) != -1 inputString.indexOf(phrase) inputString.indexOf inputString phrase -1 1 {
			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" String[] args args public class Main {
	public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} public class Main {
	public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

} Main
import java.io.*;

public class Main {
	public static void main(String[] args) throws IOException {
		String inputString, phrase;
		InputStreamReader reader = new InputStreamReader(System.in);
		BufferedReader bufferdReader = new BufferedReader(reader);
		
		inputString = bufferdReader.readLine();
		inputString = inputString + inputString;
		phrase = bufferdReader.readLine();
		if (inputString.indexOf(phrase) != -1) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

}