import java.util.Scanner;

public class Main {
  
  static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  }

} import java.util.Scanner; Scanner java.util public class Main {
  
  static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  }

} Main static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  } kaiten {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  } String newStr = ""; newStr "" newStr += str.charAt(str.length() - 1) newStr str.charAt(str.length() - 1) str.charAt str str.length() - 1 str.length() str.length str 1 for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    } int i = 0; int i = 0; i 0 i < str.length() - 1 i str.length() - 1 str.length() str.length str 1 i++ i++ i {
      newStr += str.charAt(i);
    } {
      newStr += str.charAt(i);
    } newStr += str.charAt(i) newStr str.charAt(i) str.charAt str i return newStr; newStr String str str public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  } main {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String str = sc.next(); str sc.next() sc.next sc String mohan = sc.next(); mohan sc.next() sc.next sc for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    } int i = 0; int i = 0; i 0 i < str.length() i str.length() str.length str i++ i++ i {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    } {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    } if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      } str.equals(mohan) str.equals str mohan {
        System.out.println("Yes");
        return;
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; {
        str = kaiten(str);
      } str = kaiten(str) str kaiten(str) kaiten str System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
  
  static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  }

} public class Main {
  
  static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  }

} Main
import java.util.Scanner;

public class Main {
  
  static String kaiten(String str) {
    String newStr = "";
    newStr += str.charAt(str.length() - 1);
    for(int i = 0; i < str.length() - 1; i++) {
      newStr += str.charAt(i);
    }
    return newStr;
  }

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String str = sc.next();
    String mohan = sc.next();
    for(int i = 0; i < str.length(); i++) {
      if(str.equals(mohan)) {
        System.out.println("Yes");
        return;
      }else {
        str = kaiten(str);
      }
    }
    System.out.println("No");
  }

}
