import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    }
 
    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
} 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.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    }
 
    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc System.out.println(solve(S, T) ? "Yes" : "No") System.out.println System.out System System.out solve(S, T) ? "Yes" : "No" solve(S, T) solve S T "Yes" "No" sc.close() sc.close sc String[] args args static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    } solve {
        return String.format("%s%s", S, S).contains(T);
    } return String.format("%s%s", S, S).contains(T); String.format("%s%s", S, S).contains(T) String.format("%s%s", S, S).contains String.format("%s%s", S, S) String.format String "%s%s" S S T String S S String T T public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    }
 
    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    }
 
    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
} Main
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
 
        String S = sc.next();
        String T = sc.next();
 
        System.out.println(solve(S, T) ? "Yes" : "No");
 
        sc.close();
    }
 
    static boolean solve(String S, String T) {
        return String.format("%s%s", S, S).contains(T);
    }
}