import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
	
	public static void main(String[] args) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main public static void main(String[] args) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	} main {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	} try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} IOException e {
			e.printStackTrace();
		} e.printStackTrace() e.printStackTrace e {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String s s p; p s = reader.readLine() s reader.readLine() reader.readLine reader p = reader.readLine() p reader.readLine() reader.readLine reader s = s.concat(s) s s.concat(s) s.concat s s if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			} s.contains(p) s.contains s p {
				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) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} public class Main {
	
	public static void main(String[] args) {
		try {

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

			BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
			
			String s, p;
			s = reader.readLine();
			p = reader.readLine();
			
			s = s.concat(s);
			
			if (s.contains(p)) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}