#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> v;
    for (int i = 0; i < n; i++) cin >> a[i];
    int before = 0;
    for (int i = 0; i < n - 1; i++) {
      if (a[i] == -1 && a[i + 1] != -1) v.push_back(a[i + 1]);
      if (a[i] != -1 && a[i + 1] == -1) v.push_back(a[i]);
      if (a[i] != -1 && a[i + 1] != -1)
        before = max(before, abs(a[i] - a[i + 1]));
    }
    if (v.empty())
      cout << 0 << " " << 0 << endl;
    else {
      sort(v.begin(), v.end());
      int k = (v.back() + v[0]) / 2;
      cout << max(max(v.back() - k, k - v[0]), before) << " " << k << endl;
    }
  }
  return 0;
}
