import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String sa = sc.nextLine(); sa sc.nextLine() sc.nextLine sc sa +=sa sa sa int i = sa.length(); i sa.length() sa.length sa String sb = sc.nextLine(); sb sc.nextLine() sc.nextLine sc int k = sb.length(); k sb.length() sb.length sb sc.close() sc.close sc boolean isExist = false; isExist false for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	} int l=0; int l=0; l 0 l < i l i l++ l++ l {
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	} {
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	} if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	} i - (l+k) >=0 i - (l+k) i (l+k) l k 0 {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	} if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		} sa.substring(l,l+k).equals(sb) sa.substring(l,l+k).equals sa.substring(l,l+k) sa.substring sa l l+k l k sb {
        			isExist = true;
        		} isExist = true isExist true if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } isExist {
            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 sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String sa = sc.nextLine();
        sa +=sa;
        int i = sa.length();
        String sb = sc.nextLine();
        int k = sb.length();
        sc.close();
        boolean isExist = false;
        for(int l=0; l < i;l++){
        	if(i - (l+k) >=0) {
        		if(sa.substring(l,l+k).equals(sb)){
        			isExist = true;
        		}
        	}
       	}
        if(isExist){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}
