import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    }
} import java.io.*; io.* java import java.util.Arrays; Arrays java.util class Main{
    public static void main(String[] args) throws IOException {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    }
} Main public static void main(String[] args) throws IOException {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    } main {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    } String strS strS strP; strP BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) strS = in.readLine() strS in.readLine() in.readLine in strP = in.readLine() strP in.readLine() in.readLine in StringBuffer sb = new StringBuffer(strS); sb new StringBuffer(strS) sb.append(strS) sb.append sb strS System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes")) System.out.println System.out System System.out (sb.indexOf(strP)==-1 ? "No" : "Yes") sb.indexOf(strP)==-1 sb.indexOf(strP) sb.indexOf sb strP -1 1 "No" "Yes" System.out.flush() System.out.flush System.out System System.out String[] args args
import java.io.*;
import java.util.Arrays;
class Main{
    public static void main(String[] args) throws IOException {
        String strS,strP;
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        strS = in.readLine();
        strP = in.readLine();
        StringBuffer sb = new StringBuffer(strS);
        sb.append(strS);
        System.out.println((sb.indexOf(strP)==-1 ? "No" : "Yes"));
        System.out.flush();
    }
}