#include <bits/stdc++.h>
using namespace std;
bool cmp(pair<long long, long long> &a, pair<long long, long long> &b) {
  if (a.second == b.second) return a.first < b.first;
  return a.second < b.second;
}
long long nCr(long long n, long long r) {
  long long res = 1;
  for (int i = n; i > max(r, n - r); i--) res *= i, res %= 1000000007;
  for (int i = 2; i <= min(r, n - r); i++) res /= i;
  return res % 1000000007;
}
long long exp(long long j, long long n) {
  long long i = n, res = 1;
  while (j > 0) {
    if (j & 1) res *= i;
    res %= 1000000007;
    i = i * i;
    i %= 1000000007;
    j >>= 1;
  }
  return res % 1000000007;
}
int main() {
  int T = 1;
  cin >> T;
  while (T--) {
    long long n, i, j, mx = 0, sm = 0, sz = 0;
    cin >> n;
    long long a[n];
    for (i = 0; i < n; i++) cin >> a[i];
    long long mn1 = (long long)1e10, mx1 = -1;
    vector<long long> v;
    for (i = 1; i < n; i++) {
      if (a[i] > -1 && a[i - 1] > -1) mx = max(mx, abs(a[i] - a[i - 1]));
    }
    for (i = 0; i < n; i++) {
      if (a[i] == -1) {
        if (i > 0 && i < n - 1) {
          if (a[i - 1] > -1)
            mn1 = min(mn1, a[i - 1]), mx1 = max(mx1, a[i - 1]),
            v.push_back(a[i - 1]);
          if (a[i + 1] > -1)
            mn1 = min(mn1, a[i + 1]), mx1 = max(mx1, a[i + 1]),
            v.push_back(a[i + 1]);
        } else if (i == 0) {
          if (a[i + 1] > -1)
            mn1 = min(mn1, a[i + 1]), mx1 = max(mx1, a[i + 1]),
            v.push_back(a[i + 1]);
        } else {
          if (a[i - 1] > -1)
            mn1 = min(a[i - 1], mn1), mx1 = max(mx1, a[i - 1]),
            v.push_back(a[i - 1]);
        }
      }
    }
    long long m = 0, mn = 0;
    if (!v.empty()) m = (mn1 + mx1) / 2;
    for (auto it : v) {
      mn = max(mn, abs(it - m));
    }
    cout << max(mn, mx) << ' ' << m << '\n';
  }
}
