import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String x = s + s;
        boolean b = false;
        for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        }
        if(b)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} import java.util.*; util.* java class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String x = s + s;
        boolean b = false;
        for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        }
        if(b)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String x = s + s;
        boolean b = false;
        for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        }
        if(b)
            System.out.println("Yes");
        else
            System.out.println("No");
    } main {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String x = s + s;
        boolean b = false;
        for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        }
        if(b)
            System.out.println("Yes");
        else
            System.out.println("No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String s = sc.nextLine(); s sc.nextLine() sc.nextLine sc String p = sc.nextLine(); p sc.nextLine() sc.nextLine sc String x = s + s; x s + s s s boolean b = false; b false for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        } int ix = 0; int ix = 0; ix 0 ix < s.length() ix s.length() s.length s ix++ ix++ ix {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        } {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        } for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            } int ip =0; int ip =0; ip 0 ip < p.length() ip p.length() p.length p ip++ ip++ ip {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            } {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            } b = (x.charAt(ix+ip) == p.charAt(ip)) b (x.charAt(ix+ip) == p.charAt(ip)) x.charAt(ix+ip) x.charAt x ix+ip ix ip p.charAt(ip) p.charAt p ip if(b == false)
                    break; b == false b false break; if (b == true)
                break; b == true b true break; if(b)
            System.out.println("Yes");
        else
            System.out.println("No"); b 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
import java.util.*;

class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        String p = sc.nextLine();
        String x = s + s;
        boolean b = false;
        for(int ix = 0; ix < s.length(); ix++) {
            for(int ip =0; ip < p.length(); ip++) {
            	b = (x.charAt(ix+ip) == p.charAt(ip));
                if(b == false)
                    break;
            }
            if (b == true)
                break;
        }
        if(b)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
}
