import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  private static boolean solve(char[] s, char[] t) {
    for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    }
    return false;
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  private static boolean solve(char[] s, char[] t) {
    for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    }
    return false;
  }
} Main public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } main {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) char[] s = scanner.next().toCharArray(); s scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner char[] t = scanner.next().toCharArray(); t scanner.next().toCharArray() scanner.next().toCharArray scanner.next() scanner.next scanner if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } solve(s, t) solve s t {
      System.out.println("Yes");
    } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
      System.out.println("No");
    } System.out.println("No") System.out.println System.out System System.out "No" String[] args args private static boolean solve(char[] s, char[] t) {
    for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    }
    return false;
  } solve {
    for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    }
    return false;
  } for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    } int i = 0; int i = 0; i 0 i < s.length i s.length s s.length i++ i++ i {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    } {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    } boolean ans = true; ans true for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      } int j = 0; int j = 0; j 0 j < s.length j s.length s s.length j++ j++ j {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      } {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      } if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        } s[j] != t[(j + i) % t.length] s[j] s j t[(j + i) % t.length] t (j + i) % t.length (j + i) j i t.length t t.length {
          ans = false;
          break;
        } ans = false ans false break; if (ans) return true; ans return true; true return false; false char[] s s char[] t t
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    char[] s = scanner.next().toCharArray();
    char[] t = scanner.next().toCharArray();
    if (solve(s, t)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }

  private static boolean solve(char[] s, char[] t) {
    for (int i = 0; i < s.length; i++) {
      boolean ans = true;
      for (int j = 0; j < s.length; j++) {
        if (s[j] != t[(j + i) % t.length]) {
          ans = false;
          break;
        }
      }
      if (ans) return true;
    }
    return false;
  }
}
