import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
}
 import java.util.NoSuchElementException; NoSuchElementException java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        } IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc String ss = s.concat(s); ss s.concat(s) s.concat s s boolean hasAString = ss.contains(p); hasAString ss.contains(p) ss.contains ss p System.out.println(hasAString ? "Yes" : "No") System.out.println System.out System System.out hasAString ? "Yes" : "No" hasAString "Yes" "No" String[] args args private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    } IllegalTestCaseException IllegalTestCaseException() {
            super("Illegal condition.");
        } IllegalTestCaseException {
            super("Illegal condition.");
        } super("Illegal condition.") super "Illegal condition." RuntimeException public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
} Main
import java.util.NoSuchElementException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        try {
            String s = sc.nextLine();
            String p = sc.nextLine();
            String ss = s.concat(s);
            boolean hasAString = ss.contains(p);
            System.out.println(hasAString ? "Yes" : "No");
        } catch (IllegalTestCaseException
                | NoSuchElementException
                | NumberFormatException e) {
            System.out.println(e);
        }
    }

    private static class IllegalTestCaseException extends RuntimeException {
        IllegalTestCaseException() {
            super("Illegal condition.");
        }
    }
}

