#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, inF = 1e9;
vector<int> m1;
long long t, n, m, k, a[N], mx1 = -inF;
void input() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
}
long long check(long long u) {
  long long mx = -inF;
  for (int i = 0; i < m1.size(); i++) {
    if (m1[i] != 0 && a[m1[i] - 1] != -1) mx = max(mx, abs(u - a[m1[i] - 1]));
    if (m1[i] != n - 1 && a[m1[i] + 1] != -1)
      mx = max(mx, abs(u - a[m1[i] + 1]));
  }
  return mx;
}
void solve() {
  for (int i = 0; i < n; i++) {
    if (a[i] == -1) m1.push_back(i);
    if (i != n - 1 && a[i] != -1 && a[i + 1] != -1)
      mx1 = max(mx1, abs(a[i] - a[i + 1]));
  }
  long long l = 0, r = inF;
  while (r - l > 2) {
    long long mid1 = (l + l + r) / 3;
    long long mid2 = (l + r + r) / 3;
    check(mid1) > check(mid2) ? l = mid1 : r = mid2;
  }
  k = r, m = check(r);
  if (check(l + 1) < m) m = check(l + 1), k = l + 1;
  if (check(l) < m) m = check(l), k = l;
  m = max(m, mx1);
  if (m == -inF) m = 0;
}
void output() {
  cout << m << ' ' << k << '\n';
  while (!m1.empty()) m1.pop_back();
  mx1 = -inF;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    input(), solve(), output();
  }
  return 0;
}
