import java.util.Scanner;

public class Main {

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

} import java.util.Scanner; Scanner java.util public class Main {

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

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

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

} public class Main {

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

} Main
import java.util.Scanner;

public class Main {

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

}