import java.io.*;

public class Main {
  public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
} import java.io.*; io.* java public class Main {
  public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
} Main public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  } main {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    } catch (IOException e) {
      System.out.println(e);
    } IOException e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    } String s = reader.readLine(); s reader.readLine() reader.readLine reader String p = reader.readLine(); p reader.readLine() reader.readLine reader s = s + s s s + s s s if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      } s.indexOf(p) == -1 s.indexOf(p) s.indexOf s p -1 1 {
        System.out.println("No");
      } System.out.println("No") System.out.println System.out System System.out "No" {
        System.out.println("Yes");
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main {
  public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
} public class Main {
  public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
} Main
import java.io.*;

public class Main {
  public static void main(String[] args) {
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    try {
      String s = reader.readLine();
      String p = reader.readLine();
      s = s + s;
      if (s.indexOf(p) == -1) {
        System.out.println("No");
      }
      else {
        System.out.println("Yes");
      }
    }
    catch (IOException e) {
      System.out.println(e);
    }
  }
}