import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    }
} Main public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    } main {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    } BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); input new BufferedReader(new InputStreamReader(System.in)) String a = input.readLine(); a input.readLine() input.readLine input String b = input.readLine(); b input.readLine() input.readLine input b = b + b b b + b b b System.out.println(b.contains(a) ? "Yes" : "No") System.out.println System.out System System.out b.contains(a) ? "Yes" : "No" b.contains(a) b.contains b a "Yes" "No" String[] args args public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        String a = input.readLine();
        String b = input.readLine();
        b = b + b;
        System.out.println(b.contains(a) ? "Yes" : "No");
    }
}
