import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    }
    private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    }
    private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    } main {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    } Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in))); scan new Scanner(new BufferedReader(new InputStreamReader(System.in))) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan boolean answer = solve(S, T); answer solve(S, T) solve S T System.out.println(answer ? "Yes" : "No") System.out.println System.out System System.out answer ? "Yes" : "No" answer "Yes" "No" String[] args args private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    } solve {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    } String double_S = S + S; double_S S + S S S return double_S.indexOf(T) >= 0; double_S.indexOf(T) >= 0 double_S.indexOf(T) double_S.indexOf double_S T 0 String S S String T T public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    }
    private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    }
    private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        String T = scan.next();
        boolean answer = solve(S, T);
        System.out.println(answer ? "Yes" : "No");
    }
    private static boolean solve(String S, String T) {
        String double_S = S + S;
        return double_S.indexOf(T) >= 0;
    }
}
