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