public static void main ( String args [ ] ) {
  ArrayList < String > list = new ArrayList < > ( ) ;
  Scanner sc = new Scanner ( System . in ) ;
  String S = sc . nextLine ( ) ;
  String T = sc . nextLine ( ) ;
  String tmp ;
  int L = S . length ( ) ;
  boolean check = true ;
  for ( int i = 0 ;
  i < L ;
  i ++ ) {
    list . add ( String . valueOf ( S . charAt ( i ) ) ) ;
  }
  for ( int i = 0 ;
  i < L ;
  i ++ ) {
    tmp = list . get ( L - 1 ) ;
    list . add ( 0 , tmp ) ;
    list . remove ( list . size ( ) - 1 ) ;
    int cnt = 0 ;
    for ( int j = 0 ;
    j < L ;
    j ++ ) {
      if ( list . get ( j ) . equals ( String . valueOf ( T . charAt ( j ) ) ) ) {
        cnt ++ ;
      }
    }
    if ( cnt == L ) {
      System . out . println ( "Yes" ) ;
      check = false ;
      break ;
    }
  }
  if ( check ) {
    System . out . println ( "No" ) ;
  }
}

public static void main ( String args [ ] ) { ArrayList < String > list = new ArrayList < > ( ) ; Scanner sc = new Scanner ( System . in ) ; String S = sc . nextLine ( ) ; String T = sc . nextLine ( ) ; String tmp ; int L = S . length ( ) ; boolean check = true ; for ( int i = 0 ; i < L ; i ++ ) { list . add ( String . valueOf ( S . charAt ( i ) ) ) ; } for ( int i = 0 ; i < L ; i ++ ) { tmp = list . get ( L - 1 ) ; list . add ( 0 , tmp ) ; list . remove ( list . size ( ) - 1 ) ; int cnt = 0 ; for ( int j = 0 ; j < L ; j ++ ) { if ( list . get ( j ) . equals ( String . valueOf ( T . charAt ( j ) ) ) ) { cnt ++ ; } } if ( cnt == L ) { System . out . println ( " Yes " ) ; check = false ; break ; } } if ( check ) { System . out . println ( " No " ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) consequence: (block (expression_statement (update_expression (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (assignment_expression left: (identifier) right: (false))) (break_statement))))) (if_statement condition: (parenthesized_expression (identifier)) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))))