#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long max(int a, long long b) { return max((long long)a, b); }
long long min(int a, long long b) { return min((long long)a, b); }
long long min(long long a, int b) { return min(a, (long long)b); }
long long max(long long a, int b) { return max(a, (long long)b); }
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b >>= 1;
  }
  return ans;
}
long long modu(long long k) {
  if (k >= 0)
    return k;
  else
    return -k;
}
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
    }
    vector<long long> dp;
    for (long long i = 1; i < n - 1; i++) {
      if (a[i] != -1 && (a[i - 1] == -1 || a[i + 1] == -1)) {
        dp.push_back(a[i]);
      }
    }
    if (a[0] != -1 && a[1] == -1) dp.push_back(a[0]);
    if (a[n - 1] != -1 && a[n - 2] == -1) dp.push_back(a[n - 1]);
    if (dp.size() == 0) {
      cout << "0"
           << " 42" << endl;
    } else if (dp.size() == 1) {
      long long ans = 0;
      for (long long i = 1; i < n; i++) {
        long long m = dp[0];
        if (a[i] != -1) {
          if (a[i - 1] == -1) {
            ans = max(ans, 0);
          } else {
            ans = max(ans, modu(a[i] - a[i - 1]));
          }
        } else {
          if (a[i - 1] != -1) ans = max(ans, modu(m - a[i - 1]));
        }
      }
      cout << ans << " " << dp[0] << endl;
    } else {
      sort(dp.begin(), dp.end());
      long long m = dp[0] + dp[dp.size() - 1];
      m /= 2;
      long long ans = 0;
      for (long long i = 1; i < n; i++) {
        if (a[i] != -1) {
          if (a[i - 1] == -1) {
            ans = max(ans, modu(m - a[i]));
          } else {
            ans = max(ans, modu(a[i] - a[i - 1]));
          }
        } else {
          if (a[i - 1] != -1) ans = max(ans, modu(m - a[i - 1]));
        }
      }
      cout << ans << " " << m << endl;
    }
  }
}
