public static void main ( String args [ ] ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) ;
  int m = sc . nextInt ( ) ;
  int k = sc . nextInt ( ) ;
  int mem [ ] = new int [ k + 1 ] ;
  int memf [ ] = new int [ k + 1 ] ;
  int p [ ] [ ] = new int [ n ] [ m ] ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    for ( int j = 0 ;
    j < m ;
    j ++ ) {
      p [ i ] [ j ] = sc . nextInt ( ) ;
    }
  }
  HashMap < Integer , Integer > hm = new HashMap < > ( ) ;
  int cnt = 1 ;
  for ( int i = 0 ;
  i < m ;
  i ++ ) {
    for ( int j = 0 ;
    j < n ;
    j ++ ) {
      if ( hm . get ( j + 1 ) == null ) {
        if ( p [ j ] [ i ] == 0 ) {
        }
        else if ( mem [ p [ j ] [ i ] ] == - 1 ) {
          hm . put ( j + 1 , i ) ;
        }
        else if ( mem [ p [ j ] [ i ] ] == cnt ) {
          hm . put ( j + 1 , i ) ;
          hm . put ( memf [ p [ j ] [ i ] ] , i ) ;
          mem [ p [ j ] [ i ] ] = - 1 ;
        }
        else {
          mem [ p [ j ] [ i ] ] = cnt ;
          memf [ p [ j ] [ i ] ] = j + 1 ;
        }
      }
    }
    cnt ++ ;
  }
  for ( int i = 1 ;
  i <= n ;
  i ++ ) {
    if ( hm . get ( i ) == null ) {
      System . out . println ( 0 ) ;
    }
    else {
      System . out . println ( hm . get ( i ) + 1 ) ;
    }
  }
}

public static void main ( String args [ ] ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; int m = sc . nextInt ( ) ; int k = sc . nextInt ( ) ; int mem [ ] = new int [ k + 1 ] ; int memf [ ] = new int [ k + 1 ] ; int p [ ] [ ] = new int [ n ] [ m ] ; for ( int i = 0 ; i < n ; i ++ ) { for ( int j = 0 ; j < m ; j ++ ) { p [ i ] [ j ] = sc . nextInt ( ) ; } } HashMap < Integer , Integer > hm = new HashMap < > ( ) ; int cnt = 1 ; for ( int i = 0 ; i < m ; i ++ ) { for ( int j = 0 ; j < n ; j ++ ) { if ( hm . get ( j + 1 ) == null ) { if ( p [ j ] [ i ] == 0 ) { } else if ( mem [ p [ j ] [ i ] ] == - 1 ) { hm . put ( j + 1 , i ) ; } else if ( mem [ p [ j ] [ i ] ] == cnt ) { hm . put ( j + 1 , i ) ; hm . put ( memf [ p [ j ] [ i ] ] , i ) ; mem [ p [ j ] [ i ] ] = - 1 ; } else { mem [ p [ j ] [ i ] ] = cnt ; memf [ p [ j ] [ i ] ] = j + 1 ; } } } cnt ++ ; } for ( int i = 1 ; i <= n ; i ++ ) { if ( hm . get ( i ) == null ) { System . out . println ( 0 ) ; } else { System . out . println ( hm . get ( i ) + 1 ) ; } } }
(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: (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) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) 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 (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: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (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: (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 (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 (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (null_literal))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (decimal_integer_literal))) consequence: (block) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal)) (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (unary_expression operand: (decimal_integer_literal))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))))))))))) (expression_statement (update_expression (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 (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (null_literal))) consequence: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)))))))))))