#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int Inf = 1e9 + 5;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    if (count(a.begin(), a.end(), -1) == n) {
      cout << "0 0" << endl;
      continue;
    }
    int lo = 0, hi = 1e9;
    auto p = [&](int x) {
      vector<int> b = a;
      for (int i = 0; i < n; i++) {
        if (b[i] == -1) b[i] = x;
      }
      int mx = 0;
      for (int i = 1; i < n; i++) {
        mx = max(mx, abs(b[i] - b[i - 1]));
      }
      return mx;
    };
    while (hi - lo >= 3) {
      int part = (hi - lo) / 3;
      int mid1 = lo + part;
      int mid2 = hi - part;
      if (p(mid1) <= p(mid2)) {
        hi = mid2;
      } else {
        lo = mid1;
      }
    }
    int k = -1;
    ll mn = Inf;
    for (int i = lo; i <= hi; i++) {
      ll val = p(i);
      if (val <= mn) {
        mn = val;
        k = i;
      }
    }
    cout << mn << ' ' << k << endl;
  }
  return 0;
}
