#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e5;
const int MXV = 1e9;
int n;
int a[MXN];
int f(int k) {
  int ans = 0;
  for (int i = 1; i < n; i++) {
    int x = (a[i - 1] < 0 ? k : a[i - 1]);
    int y = (a[i] < 0 ? k : a[i]);
    ans = max(ans, abs(x - y));
  }
  return ans;
}
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  int l = 0, r = MXV;
  while (r - l > 4) {
    int mid = (l + r) / 2;
    if (f(mid) < f(mid + 1)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  int ans = -1;
  int best = 2 * MXV;
  for (int i = l; i <= r; i++) {
    int cur = f(i);
    if (best > cur) ans = i, best = cur;
  }
  assert(ans != -1);
  cout << best << ' ' << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    solve();
  }
}
