import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  }

  private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  }

  private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  }
} Main public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    } {
      scanner.close();
    } scanner.close() scanner.close scanner {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    } String S = scanner.next(); S scanner.next() scanner.next scanner String T = scanner.next(); T scanner.next() scanner.next scanner int n = S.length(); n S.length() S.length S for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      } {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      } if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        } valid(S,T,n,i) valid S T n i {
          System.out.println("Yes");
          return;
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" String[] args args private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  } valid {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  } for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    } {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    } if (s.charAt(i) != t.charAt((i+offset)%n)) return false; s.charAt(i) != t.charAt((i+offset)%n) s.charAt(i) s.charAt s i t.charAt((i+offset)%n) t.charAt t (i+offset)%n (i+offset) i offset n return false; false return true; true String s s String t t int n n int offset offset public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  }

  private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  }
} public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  }

  private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner scanner = new Scanner(System.in);
    try {
      String S = scanner.next();
      String T = scanner.next();
      int n = S.length();
      
      for (int i = 0; i < n; i++) {
        if (valid(S,T,n,i)) {
          System.out.println("Yes");
          return;
        }
      }
      System.out.println("No");
    }
    finally {
      scanner.close();
    }
  }

  private static boolean valid(String s, String t, int n, int offset) {
    for (int i = 0; i < n; i++) {
      if (s.charAt(i) != t.charAt((i+offset)%n)) return false;
    }
    return true;
  }
}