input: from typing import List
  
  def modified_matrix(matrix: List[List[int]]) -> List[List[int]]:
      """
      Given a 0-indexed m x n integer matrix matrix, create a new 0-indexed matrix called answer. Make answer equal to matrix, then replace each element with the value -1 with the maximum element in its respective column.
  
      Return the matrix answer.
  
      Examples:
      >>> matrix = [[1,2,-1],[4,-1,6],[7,8,9]]
      [[1,2,9],[4,8,6],[7,8,9]]
      >>> matrix = [[3,-1],[5,2]]
      [[3,2],[5,2]]
  
      Constraints:
      m == matrix.length
      n == matrix[i].length
      2 <= m, n <= 50
      -1 <= matrix[i][j] <= 100
      The input is generated such that each column contains at least one non-negative integer.
      """
  
output: 
      answer = [row[:] for row in matrix]
      for col in range(len(matrix[0])):
          max_val = max(matrix[row][col] for row in range(len(matrix)) if matrix[row][col] != -1)
          for row in range(len(matrix)):
              if answer[row][col] == -1:
                  answer[row][col] = max_val
      return answer
  