#include <bits/stdc++.h>
using namespace std;
int T, n, k, a[100005], b[200005], num, m;
int ab(int x) { return x > 0 ? x : -x; }
int main() {
  ios::sync_with_stdio(false);
  cin >> T;
  int i;
  while (T--) {
    cin >> n;
    m = num = 0;
    a[0] = a[n + 1] = -1;
    for (i = 1; i <= n; i++) cin >> a[i];
    for (i = 1; i <= n; i++) {
      if (a[i] == -1) {
        if (a[i - 1] >= 0) b[++num] = a[i - 1];
        if (a[i + 1] >= 0) b[++num] = a[i + 1];
      }
    }
    sort(b + 1, b + num + 1);
    k = (b[1] + b[num]) / 2;
    for (i = 1; i <= n; i++)
      if (a[i] == -1) a[i] = k;
    for (i = 1; i < n; i++) m = max(m, ab(a[i] - a[i + 1]));
    cout << m << ' ' << k << endl;
  }
  return 0;
}
