#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<long long> otv[2];
  while (t--) {
    int n;
    cin >> n;
    vector<long long> a(n + 2);
    a[0] = -2;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    a[n + 1] = -2;
    long long min1 = INT_MAX, max1 = INT_MIN;
    for (int i = 1; i <= n; i++) {
      if ((a[i - 1] == -1 || a[i + 1] == -1) && (a[i] > -1)) {
        if (a[i] < min1) {
          min1 = a[i];
        }
        if (a[i] > max1) {
          max1 = a[i];
        }
      }
    }
    if (max1 == INT_MIN) {
      max1 = 0;
      min1 = 0;
    }
    long long k = min1 + (max1 - min1) / 2, m = 0;
    for (int i = 0; i <= n; i++) {
      if (a[i] == -1) {
        a[i] = k;
      }
    }
    for (int i = 1; i <= n - 1; i++) {
      if (abs(a[i + 1] - a[i]) > m) {
        m = abs(a[i + 1] - a[i]);
      }
    }
    otv[0].push_back(m);
    otv[1].push_back(k);
  }
  for (int i = 0; i < otv[0].size(); i++) {
    cout << otv[0][i] << " " << otv[1][i] << "\n";
  }
}
