#include <bits/stdc++.h>
using namespace std;
const long long MAX = 5e2 + 5, N = 2e5 + 5;
const long long MOD = 1e9 + 7, mod = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mn(long long a[], long long n, long long k) {
  long long i;
  long long ans = 0;
  long long b[n];
  for (i = 0; i < n; i++) (a[i] == -1) ? b[i] = k : b[i] = a[i];
  for (i = 1; i < n; i++) ans = max(ans, abs(b[i] - b[i - 1]));
  return ans;
}
void solve(long long tt) {
  long long n, m, i, j, k, x, y, z, bb = 0;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  vector<long long> v;
  for (i = 0; i < n; i++) {
    if (a[i] == -1) continue;
    if (i)
      if (a[i - 1] == -1) v.push_back(a[i]);
    if (i + 1 < n)
      if (a[i + 1] == -1) v.push_back(a[i]);
  }
  sort(v.begin(), v.end());
  long long ans = 0;
  if (v.size()) ans = (v[0] + v[v.size() - 1]) >> 1;
  cout << mn(a, n, ans) << " " << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T = 1;
  cin >> T;
  while (T--) solve(T);
  return 0;
}
