#include <bits/stdc++.h>
using namespace std;
long long a[100003];
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t, n, k, m;
  long long M, mi;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<long long> v;
    a[0] = 0, a[n + 1] = 0;
    M = 0, mi = 1e+9, m = 0;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++)
      if (a[i] != -1 && (a[i + 1] == -1 || a[i - 1] == -1)) v.push_back(a[i]);
    for (auto itr = v.begin(); itr != v.end(); itr++) {
      if (*itr > M) M = *itr;
      if (*itr < mi) mi = *itr;
    }
    k = (M + mi) / 2;
    for (int i = 1; i <= n; i++)
      if (a[i] == -1) a[i] = k;
    for (int i = 2; i <= n; i++)
      m = (m > ((a[i] - a[i - 1]) >= 0 ? (a[i] - a[i - 1])
                                       : (-(a[i] - a[i - 1])))
               ? m
               : ((a[i] - a[i - 1]) >= 0 ? (a[i] - a[i - 1])
                                         : (-(a[i] - a[i - 1]))));
    cout << m << " " << k << "\n";
  }
}
