import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}
 import java.util.ArrayDeque; ArrayDeque java.util import java.util.HashMap; HashMap java.util import java.util.Queue; Queue java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    } main {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } scanner.hasNext() scanner.hasNext scanner {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        } String inp = scanner.nextLine(); inp scanner.nextLine() scanner.nextLine scanner String str = inp+inp; str inp+inp inp inp String key = scanner.nextLine(); key scanner.nextLine() scanner.nextLine scanner if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            } str.contains(key) str.contains str key {
                System.out.println("Yes");
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
                System.out.println("No");
            } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
} Main
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            String inp = scanner.nextLine();
            String str = inp+inp;
            String key = scanner.nextLine();

            if(str.contains(key)) {
                System.out.println("Yes");
            } else {
                System.out.println("No");
            }
        }
    }
}

