/**
 * Given a nested list, find the first negative number
 * and return its position as a Pair(row, column).
 *
 * @param matrix A nested list representing a matrix
 * @return A Pair(row, column) indicating the position of the first negative number
 *
 * Example:
 * findFirstNegativeNumber(listOf(listOf(1, 2, 3), listOf(4, -5, 6), listOf(7, 8, -9))) // returns Pair(1, 1)
 */
fun findFirstNegativeNumber(matrix: List<List<Int>>): Pair<Int, Int>? {

    for (row in matrix.indices) {
        for (col in matrix[row].indices) {
            if (matrix[row][col] < 0) {
                return Pair(row, col)
            }
        }
    }
    return null
}
/**
 * Given a nested list, find the first negative number
 * and return its position as a Pair(row, column).
 *
 * @param matrix A nested list representing a matrix
 * @return A Pair(row, column) indicating the position of the first negative number
 *
 * Example:
 * findFirstNegativeNumber(listOf(listOf(1, 2, 3), listOf(4, -5, 6), listOf(7, 8, -9))) // returns Pair(1, 1)
 */
fun findFirstNegativeNumber(matrix: List<List<Int>>): Pair<Int, Int>? {
/**
 * Given a nested list, find the first negative number
 * and return its position as a Pair(row, column).
 *
 * @param matrix A nested list representing a matrix
 * @return A Pair(row, column) indicating the position of the first negative number
 *
 * Example:
 * findFirstNegativeNumber(listOf(listOf(1, 2, 3), listOf(4, -5, 6), listOf(7, 8, -9))) // returns Pair(1, 1)
 */
fun findFirstNegativeNumber(matrix: List<List<Int>>): Pair<Int, Int>? {

    for (row in matrix.indices) {
        for (col in matrix[row].indices) {
            if (matrix[row][col] < 0) {
                return Pair(row, col)
            }
        }
    }
    return null
}