import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	} main {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	} try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		} {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		} Scanner sc = new Scanner(System.in) Scanner sc = new Scanner(System.in) new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String t = sc.next(); t sc.next() sc.next sc t = t + t t t + t t t System.out.println(t.contains(s) ? "Yes" : "No") System.out.println System.out System System.out t.contains(s) ? "Yes" : "No" t.contains(s) t.contains t s "Yes" "No" String[] args args public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	}
} public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	}
} Main
import java.io.IOException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		try (Scanner sc = new Scanner(System.in);) {

			String s = sc.next();
			String t = sc.next();

			t = t + t;
			System.out.println(t.contains(s) ? "Yes" : "No");

		}

	}
}
