import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.nextLine();
        String queryIn = sc.nextLine();
        CharSequence query = queryIn.subSequence(0, queryIn.length());
        String ring = target.concat(target);
        if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No");
    }
} import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.nextLine();
        String queryIn = sc.nextLine();
        CharSequence query = queryIn.subSequence(0, queryIn.length());
        String ring = target.concat(target);
        if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.nextLine();
        String queryIn = sc.nextLine();
        CharSequence query = queryIn.subSequence(0, queryIn.length());
        String ring = target.concat(target);
        if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String target = sc.nextLine();
        String queryIn = sc.nextLine();
        CharSequence query = queryIn.subSequence(0, queryIn.length());
        String ring = target.concat(target);
        if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String target = sc.nextLine(); target sc.nextLine() sc.nextLine sc String queryIn = sc.nextLine(); queryIn sc.nextLine() sc.nextLine sc CharSequence query = queryIn.subSequence(0, queryIn.length()); query queryIn.subSequence(0, queryIn.length()) queryIn.subSequence queryIn 0 queryIn.length() queryIn.length queryIn String ring = target.concat(target); ring target.concat(target) target.concat target target if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No"); ring.contains(query) ring.contains ring query System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.nextLine();
        String queryIn = sc.nextLine();
        CharSequence query = queryIn.subSequence(0, queryIn.length());
        String ring = target.concat(target);
        if (ring.contains(query)) System.out.println("Yes");
        else System.out.println("No");
    }
}
