Thirty nine nonzero numbers are written in a row. The sum of any two neighbouring numbers is positive, while the sum of all the numbers is negative. Is the product of all these numbers negative or positive?    (4 points)
                                                                                                                           
                                                       Boris Frenkin
1. **Define the sequence and conditions:**
   Let \( a_n \) be the terms of the sequence where \( n \in \{1, 2, \dots, 39\} \). We know:
   - The sum of any two neighboring numbers is positive: \( a_i + a_{i+1} > 0 \) for all \( i \in \{1, 2, \dots, 38\} \).
   - The sum of all the numbers is negative: \( S = a_1 + a_2 + \cdots + a_{39} < 0 \).

2. **Analyze the sum of consecutive terms:**
   For any \( m \in \{1, 2, \dots, 19\} \), the sum of consecutive \( 2m \) terms is positive. Specifically:
   \[
   a_2 + a_3 + \cdots + a_{38} + a_{39} > 0
   \]
   Given \( S < 0 \), we can infer:
   \[
   a_1 + (a_2 + a_3 + \cdots + a_{38} + a_{39}) < 0 \implies a_1 < 0
   \]

3. **Analyze the sum excluding the first and last terms:**
   Similarly, consider the sum excluding the first term:
   \[
   a_1 + a_2 + \cdots + a_{37} + a_{38} > 0
   \]
   Given \( S < 0 \), we can infer:
   \[
   (a_1 + a_2 + \cdots + a_{37} + a_{38}) + a_{39} < 0 \implies a_{39} < 0
   \]

4. **Generalize for all odd-indexed terms:**
   For any \( m \in \{1, 2, \dots, 18\} \), we can write:
   \[
   S = (a_1 + a_2 + \cdots + a_{2m}) + a_{2m+1} + (a_{2m+2} + a_{2m+3} + \cdots + a_{39}) < 0
   \]
   Since \( a_1 + a_2 + \cdots + a_{2m} > 0 \) and \( a_{2m+2} + a_{2m+3} + \cdots + a_{39} > 0 \), it follows that:
   \[
   a_{2m+1} < 0 \quad \forall m \in \{0, 1, 2, \dots, 19\}
   \]

5. **Determine the sign of even-indexed terms:**
   Given \( a_{2m} + a_{2m+1} > 0 \) and \( a_{2m+1} < 0 \), it follows that:
   \[
   a_{2m} > 0 \quad \forall m \in \{1, 2, \dots, 19\}
   \]

6. **Conclusion:**
   The sequence \( (a_n) \) contains exactly 20 negative terms ( \( a_1, a_3, a_5, \dots, a_{39} \) ) and 19 positive terms ( \( a_2, a_4, a_6, \dots, a_{38} \) ). Therefore, the product of all these numbers is:
   \[
   P = a_1 \cdot a_2 \cdot \cdots \cdot a_{39}
   \]
   Since the product of an even number of negative terms is positive, the product \( P \) is positive.

The final answer is \(\boxed{\text{positive}}\).