import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} import java.util.Scanner; Scanner java.util public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} Main public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  } main {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  } Scanner in = new Scanner(System.in); in new Scanner(System.in) while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } in.hasNext() in.hasNext in {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    } String S = in.next(); S in.next() in.next in String T = in.next(); T in.next() in.next in boolean rotationEqual = false; rotationEqual false for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      } int i = 0; int i = 0; i 0 i < S.length() i S.length() S.length S ++i ++i i {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      } {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      } if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        } T.equals(S.substring(i) + S.substring(0, i)) T.equals T S.substring(i) + S.substring(0, i) S.substring(i) S.substring S i S.substring(0, i) S.substring S 0 i {
          rotationEqual = true;
          break;
        } rotationEqual = true rotationEqual true break; if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      } rotationEqual {
        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 public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
} Main
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);
    
    
    while (in.hasNext()) {
      String S = in.next();
      String T = in.next();
      boolean rotationEqual = false;

      for (int i = 0; i < S.length(); ++i) {
        if (T.equals(S.substring(i) + S.substring(0, i))) {
          rotationEqual = true;
          break;
        }
      }

      if (rotationEqual) {
        System.out.println("Yes");
      } else {
        System.out.println("No");
      }
    }
  }
}