import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    } main {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) String s = sc.next(); s sc.next() sc.next sc final String T = sc.next(); T sc.next() sc.next sc s += s s s out.println(s.contains(T) ? "Yes" : "No") out.println out s.contains(T) ? "Yes" : "No" s.contains(T) s.contains s T "Yes" "No" out.flush() out.flush out String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    }
} Main
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        String s = sc.next();
        final String T = sc.next();

        s += s;
        
        out.println(s.contains(T) ? "Yes" : "No");
        
        out.flush();
    }
}