import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} import java.util.*; util.* java public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String S = sc.next(); S sc.next() sc.next sc String T = sc.next(); T sc.next() sc.next sc Boolean f = false; f false int l = S.length(); l S.length() S.length S for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    } int i=0; int i=0; i 0 i<=l i l i++ i++ i {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    } {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    } if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      } S.equals(T) S.equals S T {
        f = true;
        break;
      } f = true f true break; {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      } S = S.substring(l-1, l) + S.substring(0, l-1) S S.substring(l-1, l) + S.substring(0, l-1) S.substring(l-1, l) S.substring S l-1 l 1 l S.substring(0, l-1) S.substring S 0 l-1 l 1 if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    } f {
      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 sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
} Main
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    String S = sc.next();
    String T = sc.next();
    Boolean f = false;
    int l = S.length();
    
    for(int i=0; i<=l; i++) {
      if(S.equals(T)) {
        f = true;
        break;
      } else {
        S = S.substring(l-1, l) + S.substring(0, l-1);
      }
    }
    if(f) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}