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

public class Main {
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
} Main public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    } exec {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) String s = br.readLine(); s br.readLine() br.readLine br String p = br.readLine(); p br.readLine() br.readLine br out.println((s+s).contains(p)?"Yes":"No") out.println out (s+s).contains(p)?"Yes":"No" (s+s).contains(p) (s+s).contains (s+s) s s p "Yes" "No" out.flush() out.flush out public static void main(String[] args) throws IOException {
    	new Main().exec();
    } main {
    	new Main().exec();
    } new Main().exec() new Main().exec new Main() String[] args args public class Main {
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
} public class Main {
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public void exec() throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	PrintWriter out = new PrintWriter(System.out);
    	String s = br.readLine();
    	String p = br.readLine();
    	out.println((s+s).contains(p)?"Yes":"No");
        out.flush();
    }
 
    public static void main(String[] args) throws IOException {
    	new Main().exec();
    }
}