import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
    public static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
    public static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    }
} Main public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    } main {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String s = scan.nextLine(); s scan.nextLine() scan.nextLine scan String p = scan.nextLine(); p scan.nextLine() scan.nextLine scan if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	} match(s, p) match 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 static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    } match {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    } int pLength = p.length(); pLength p.length() p.length p String doubleS = s + s; doubleS s + s s s for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	} int i = 0; int i = 0; i 0 i < s.length() i s.length() s.length s i++ i++ i {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	} {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	} String word = doubleS.substring(i, i+pLength); word doubleS.substring(i, i+pLength) doubleS.substring doubleS i i+pLength i pLength if (word.equals(p)) {
		return true;
	    } word.equals(p) word.equals word p {
		return true;
	    } return true; true return false; false String s s String p p public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
    public static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    }
} public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
    public static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    }
} Main
import java.util.Scanner;
public class Main {
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	String s = scan.nextLine();
	String p = scan.nextLine();
	if (match(s, p)) {
	    System.out.println("Yes");
	} else {
	    System.out.println("No");
	}
    }
    public static boolean match (String s, String p) {
	int pLength = p.length();
	String doubleS = s + s;
	for (int i = 0; i < s.length(); i++) {
	    String word = doubleS.substring(i, i+pLength);
	    if (word.equals(p)) {
		return true;
	    }
	}
	return false;
    }
}