#include <bits/stdc++.h>
using namespace std;
long long int ft[100005];
void factorial(long long int p) {
  ft[0] = 1;
  for (long long int i = 1; i < 100005; i++) {
    ft[i] = (ft[i - 1] * i) % p;
  }
}
long long int power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int ncr(long long int n, long long int r, long long int p) {
  factorial(p);
  return (ft[n] * ((power(ft[r], p - 2, p) * power(ft[n - r], p - 2, p)) % p)) %
         p;
}
long long int findk(vector<long long int> A, long long int k) {
  long long int ans = LONG_MIN;
  for (long long int i = 0; i + 1 < A.size(); i++) {
    if (A[i] == -1) A[i] = k;
    if (A[i + 1] == -1) A[i + 1] = k;
    ans = max(ans, abs(A[i] - A[i + 1]));
  }
  return ans;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int start = 0;
  long long int end = 1000000000;
  long long int ans = 0;
  long long int k = LONG_MAX;
  long long int m = 0;
  while (start <= end) {
    long long int mid = start + (end - start) / 2;
    long long int mid1 = start + (mid - start - 1) / 2;
    long long int mid2 = mid + (end - mid + 1) / 2;
    long long int k1 = findk(a, mid1);
    long long int k2 = findk(a, mid2);
    if (k1 < k2) {
      end = mid - 1;
      if (k > k1) {
        k = k1;
        m = mid1;
      }
    } else {
      start = mid + 1;
      if (k > k2) {
        k = k2;
        m = mid2;
      }
    }
  }
  cout << k << " " << m << endl;
}
signed main() {
  long long int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
