#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  for (long long int z = 0; z < t; z++) {
    long long int n;
    cin >> n;
    vector<int> v(n);
    for (long long int i = 0; i < n; i++) {
      cin >> v[i];
    }
    long long int minm = INT_MAX, maxm = INT_MIN;
    for (long long int i = 0; i < n; i++) {
      if (v[i] >= 0 &&
          ((v[i - 1] == -1 && i >= 1) || (v[i + 1] == -1 && i < n - 1))) {
        if (v[i] < minm) minm = v[i];
        if (v[i] > maxm) maxm = v[i];
      }
    }
    long long int k = (minm + maxm) / 2, diff = INT_MIN;
    for (long long int i = 0; i < n; i++) {
      if (v[i] == -1) v[i] = k;
    }
    for (long long int i = 0; i < n - 1; i++) {
      if (diff < fabs(v[i] - v[i + 1])) {
        diff = fabs(v[i] - v[i + 1]);
      }
    }
    cout << diff << " " << k << endl;
  }
  return 0;
}
