public static void main ( String [ ] args ) {
  int n = in . nextInt ( ) ;
  int k1 = in . nextInt ( ) ;
  int [ ] s1 = genNums ( k1 ) ;
  int k2 = in . nextInt ( ) ;
  int [ ] s2 = genNums ( k2 ) ;
  int [ ] result1 = new int [ n ] ;
  int [ ] result2 = new int [ n ] ;
  for ( int i = 0 ;
  i < k1 ;
  i ++ ) {
    result1 [ n - s1 [ i ] ] = 1 ;
  }
  for ( int i = 0 ;
  i < k2 ;
  i ++ ) {
    result2 [ n - s2 [ i ] ] = 1 ;
  }
  result2 [ 0 ] = - 1 ;
  result1 [ 0 ] = - 1 ;
  boolean changed = true ;
  while ( changed ) {
    changed = false ;
    for ( int i = n - 1 ;
    i > 0 ;
    i -- ) {
      changed = stateChanged ( n , k1 , s1 , result1 , result2 , changed , i ) ;
      changed = stateChanged ( n , k2 , s2 , result2 , result1 , changed , i ) ;
    }
  }
  printRound ( n , result1 ) ;
  System . out . println ( ) ;
  printRound ( n , result2 ) ;
}

public static void main ( String [ ] args ) { int n = in . nextInt ( ) ; int k1 = in . nextInt ( ) ; int [ ] s1 = genNums ( k1 ) ; int k2 = in . nextInt ( ) ; int [ ] s2 = genNums ( k2 ) ; int [ ] result1 = new int [ n ] ; int [ ] result2 = new int [ n ] ; for ( int i = 0 ; i < k1 ; i ++ ) { result1 [ n - s1 [ i ] ] = 1 ; } for ( int i = 0 ; i < k2 ; i ++ ) { result2 [ n - s2 [ i ] ] = 1 ; } result2 [ 0 ] = - 1 ; result1 [ 0 ] = - 1 ; boolean changed = true ; while ( changed ) { changed = false ; for ( int i = n - 1 ; i > 0 ; i -- ) { changed = stateChanged ( n , k1 , s1 , result1 , result2 , changed , i ) ; changed = stateChanged ( n , k2 , s2 , result2 , result1 , changed , i ) ; } } printRound ( n , result1 ) ; System . out . println ( ) ; printRound ( n , result2 ) ; }
(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: (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) right: (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 (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) right: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (unary_expression operand: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (unary_expression operand: (decimal_integer_literal)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (true))) (while_statement condition: (parenthesized_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (false))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (decimal_integer_literal)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (identifier) (identifier) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (identifier) (identifier) (identifier))))))))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))))