#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
inline long long add(long long a, long long b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
inline long long sub(long long a, long long b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
inline long long mul(long long a, long long b) {
  return (long long)((long long)a * b % 1000000007);
}
long long arr[100000 + 5];
long long n;
long long binhelp(long long k) {
  long long md = 0;
  for (long long i = 0; i < n - 1; i += 1) {
    if (arr[i] == -1 && arr[i + 1] != -1)
      md = max(md, abs(k - arr[i + 1]));
    else if (arr[i + 1] == -1 && arr[i] != -1)
      md = max(md, abs(k - arr[i]));
    else if (arr[i + 1] != -1 && arr[i] != -1)
      md = max(md, abs(arr[i] - arr[i + 1]));
  }
  return md;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 0; i < n; i += 1) cin >> arr[i];
    long long low = 0;
    long long high = 1e9 + 5;
    while (low != high) {
      long long mid = (low + high) / 2;
      long long req = binhelp(mid), req2 = binhelp(mid + 1);
      if (req <= req2)
        high = mid;
      else
        low = mid + 1;
    }
    cout << binhelp((low + high) / 2) << " " << (low + high) / 2 << "\n";
  }
}
