import java.util.Scanner;
public class Main{
    public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    } judge {
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    } String ss = s.concat(s); ss s.concat(s) s.concat s s if(ss.contains(p))
            return true; ss.contains(p) ss.contains ss p return true; true return false; false String s s String p p public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No"); judge(s,p) judge s p 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 public class Main{
    public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} public class Main{
    public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main
import java.util.Scanner;
public class Main{
    public static boolean judge(String s, String p){
        String ss = s.concat(s);
        if(ss.contains(p))
            return true;
        return false;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String p = sc.next();
        if(judge(s,p))
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
