#include <bits/stdc++.h>
using namespace std;
long long const N = 10e5 + 10;
long long arr[N];
long long sum[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> vec(n);
    long long mi = 0;
    for (long long i = 0; i < n; i++) {
      cin >> vec[i];
    }
    set<long long> se;
    for (long long i = 0; i < n; i++) {
      if (i + 1 < n && vec[i] != -1 && vec[i + 1] != -1)
        mi = ((mi) > (abs(vec[i] - vec[i + 1])) ? (mi)
                                                : (abs(vec[i] - vec[i + 1])));
      if (vec[i] == -1) {
        if (i + 1 < n && vec[i + 1] != -1) se.insert(vec[i + 1]);
        if (i >= 1 && vec[i - 1] != -1) se.insert(vec[i - 1]);
      }
    }
    if (se.size() == 0) {
      cout << 0 << " " << 0 << endl;
      continue;
    }
    long long mid = (*(--se.end()) + *se.begin()) / 2;
    long long diff = *(--se.end()) - mid;
    cout << ((diff) > (mi) ? (diff) : (mi)) << " " << mid << endl;
  }
  return 0;
}
