#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> vec(n, 0);
  for (long long i = 0; i < n; i++) cin >> vec[i];
  long long mn = 10e9 + 1, mx = -1, count = 0;
  for (long long i = 1; i < n; i++) {
    if (vec[i] == -1 && vec[i - 1] != -1) {
      mn = min(mn, vec[i - 1]);
      mx = max(mx, vec[i - 1]);
    }
  }
  for (long long i = 0; i < n - 1; i++) {
    if (vec[i] == -1 && vec[i + 1] != -1) {
      mn = min(mn, vec[i + 1]);
      mx = max(mx, vec[i + 1]);
    }
  }
  if (mx == -1) {
    cout << 0 << " " << 0 << endl;
  } else {
    long long k = (mx + mn) / 2;
    for (long long i = 0; i < n; i++) {
      if (vec[i] == -1) {
        vec[i] = k;
      }
    }
    long long dif = 0;
    for (long long i = 1; i < n; i++) {
      dif = max(dif, abs(vec[i] - vec[i - 1]));
    }
    cout << dif << " " << k << endl;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
