#include <bits/stdc++.h>
using namespace std;
int n, v[100005], a[100005], t, minim, maxim, i, st, dr, sum, mij, valoare, k;
int val(int k) {
  int i, sum = 0;
  for (i = 1; i <= n; i++) {
    if (v[i] == -1) {
      a[i] = k;
    } else {
      a[i] = v[i];
    }
  }
  sum = 0;
  for (i = 1; i <= n - 1; i++) {
    sum = max(sum, abs(a[i + 1] - a[i]));
  }
  return sum;
}
int main() {
  cin >> t;
  for (; t--;) {
    cin >> n;
    minim = INT_MAX;
    maxim = 0;
    for (i = 1; i <= n; i++) {
      cin >> v[i];
    }
    for (i = 1; i <= n - 1; i++) {
      if (v[i] != -1 && (v[i - 1] == -1 || v[i + 1] == -1)) {
        minim = min(minim, v[i]);
        maxim = max(maxim, v[i]);
      }
    }
    if (v[n - 1] == -1 && v[n] != -1) {
      minim = min(minim, v[i]);
      maxim = max(maxim, v[i]);
    }
    if (minim == INT_MAX) {
      cout << "0"
           << " "
           << "0" << '\n';
    } else {
      cout << val((minim + maxim) / 2) << " ";
      cout << (minim + maxim) / 2 << '\n';
    }
  }
  return 0;
}
