public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) ;
  int a = sc . nextInt ( ) ;
  int x = sc . nextInt ( ) ;
  int b = sc . nextInt ( ) ;
  int y = sc . nextInt ( ) ;
  int p1 = a ;
  int p2 = b ;
  List < Integer > st1 = new ArrayList < > ( ) ;
  List < Integer > st2 = new ArrayList < > ( ) ;
  while ( p1 != x ) {
    st1 . add ( p1 ) ;
    p1 ++ ;
    if ( p1 == ( n + 1 ) ) {
      p1 = 1 ;
    }
  }
  st1 . add ( p1 ) ;
  while ( p2 != y ) {
    st2 . add ( p2 ) ;
    p2 -- ;
    if ( p2 == ( 0 ) ) {
      p2 = n ;
    }
  }
  st2 . add ( p2 ) ;
  for ( int i = 0 ;
  i < Math . min ( st1 . size ( ) , st2 . size ( ) ) ;
  i ++ ) {
    if ( st1 . get ( i ) . equals ( st2 . get ( i ) ) ) {
      System . out . println ( "YES" ) ;
      return ;
    }
  }
  System . out . println ( "NO" ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int a = sc . nextInt ( ) ; int x = sc . nextInt ( ) ; int b = sc . nextInt ( ) ; int y = sc . nextInt ( ) ; int p1 = a ; int p2 = b ; List < Integer > st1 = new ArrayList < > ( ) ; List < Integer > st2 = new ArrayList < > ( ) ; while ( p1 != x ) { st1 . add ( p1 ) ; p1 ++ ; if ( p1 == ( n + 1 ) ) { p1 = 1 ; } } st1 . add ( p1 ) ; while ( p2 != y ) { st2 . add ( p2 ) ; p2 -- ; if ( p2 == ( 0 ) ) { p2 = n ; } } st2 . add ( p2 ) ; for ( int i = 0 ; i < Math . min ( st1 . size ( ) , st2 . size ( ) ) ; i ++ ) { if ( st1 . get ( i ) . equals ( st2 . get ( i ) ) ) { System . out . println ( " YES " ) ; return ; } } System . out . println ( " NO " ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (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: (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)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (update_expression (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (parenthesized_expression (decimal_integer_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))))) (expression_statement (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: (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))))) 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 (identifier)))))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal)))) (return_statement))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (string_literal))))))