import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) 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);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int i = 0; i 0 boolean flag = false; flag false String s = sc.next(); s sc.next() sc.next sc String p = sc.next(); p sc.next() sc.next sc s = s.concat(s) s s.concat(s) s.concat s s for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        } i = 0; i = 0 i 0 i < s.length() - p.length() i s.length() - p.length() s.length() s.length s p.length() p.length p i++ i++ i {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        } {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        } if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	} p.equals(s.substring(i, p.length() + i)) p.equals p s.substring(i, p.length() + i) s.substring s i p.length() + i p.length() p.length p i {
        		flag = true;
        		break;
        	} flag = true flag true break; if(flag) System.out.println("Yes");
        else System.out.println("No"); flag System.out.println("Yes") System.out.println System.out System System.out "Yes" 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);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) 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);
        int i = 0;
        boolean flag = false;
        String s = sc.next();
        String p = sc.next();
        
        s = s.concat(s);
        
        for(i = 0; i < s.length() - p.length(); i++) {
        	if(p.equals(s.substring(i, p.length() + i))) {
        		flag = true;
        		break;
        	}
        }
        
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }
}
