#include <bits/stdc++.h>
using namespace std;
const int MAX = 4e5 + 10;
int n, a[MAX];
int f(int x) {
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    v[i] = (a[i] == -1 ? x : a[i]);
  }
  int ret = 0;
  for (int i = 0; i < n - 1; ++i) {
    ret = max(ret, abs(v[i] - v[i + 1]));
  }
  return ret;
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long beg = 0, end = 1e9;
  while (end - beg > 3) {
    long long mid1 = (2 * beg + end) / 3;
    long long mid2 = (beg + 2 * end) / 3;
    int f1 = f(mid1);
    int f2 = f(mid2);
    if (f1 > f2) {
      beg = mid1 + 1;
    } else if (f1 <= f2) {
      end = mid2 - 1;
    }
  }
  int ans = 1e9, ind;
  for (int i = beg; i <= end; ++i) {
    int t = f(i);
    if (t < ans) {
      ans = t;
      ind = i;
    }
  }
  cout << ans << ' ' << ind << '\n';
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    solve();
  }
}
