------
## 最终结论
To solve the problem, we need to determine the optimal integer `k` that minimizes the maximum absolute difference between adjacent elements in an array after replacing all missing elements (denoted by `-1`) with `k`. Here's how we can achieve this:

```python
def find_min_max_known_elements(a):
    min_known = float('inf')
    max_known = float('-inf')
    
    for value in a:
        if value != -1:
            min_known = min(min_known, value)
            max_known = max(max_known, value)
    
    return min_known, max_known

def calculate_optimal_k(min_known, max_known):
    return (min_known + max_known) // 2

def calculate_maximum_difference(a, k):
    m = 0
    n = len(a)
    
    for i in range(n - 1):
        if a[i] == -1:
            diff = abs(k - (a[i + 1] if a[i + 1] != -1 else k))
        elif a[i + 1] == -1:
            diff = abs(a[i] - k)
        else:
            diff = abs(a[i] - a[i + 1])
        
        m = max(m, diff)
    
    return m

def find_min_m_and_k(test_cases):
    results = []
    
    for n, a in test_cases:
        min_known, max_known = find_min_max_known_elements(a)
        
        if min_known == float('inf') and max_known == float('-inf'):
            # If there are no known elements (all are -1), choose any k
            k = 0
        else:
            k = calculate_optimal_k(min_known, max_known)
        
        m = calculate_maximum_difference(a, k)
        
        results.append((m, k))
    
    return results

# Reading input and preparing test cases
import sys
input = sys.stdin.read
data = input().split()

index = 0
t = int(data[index])
index += 1

test_cases = []
for _ in range(t):
    n = int(data[index])
    index += 1
    array = list(map(int, data[index:index+n]))
    index += n
    test_cases.append((n, array))

# Get results for each test case
results = find_min_m_and_k(test_cases)

# Output results
for result in results:
    print(result[0], result[1])
```

This code will efficiently solve the problem by iterating over the array to find known values and then determining the optimal `k` as the average of the minimum and maximum known values. It then calculates the maximum difference using this `k` and outputs it for each test case.