#include <bits/stdc++.h>
using namespace std;
int ork(int v, int k) { return v == -1 ? k : v; }
int calc(const vector<int> &v, int k) {
  int diff = -1;
  for (int i = 0; i < v.size() - 1; i++) {
    diff = max(diff, abs(ork(v[i], k) - ork(v[i + 1], k)));
  }
  return diff;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int &x : v) cin >> x;
    int solV = 1e9 + 10, solK;
    int l = -1, r = 1e9 + 1;
    while (l < r - 1) {
      int m = (l + r) / 2;
      if (m < 0 || m > 1e9) continue;
      int d1 = calc(v, m), d2 = calc(v, m + 1);
      if (solV > d1) {
        solV = d1;
        solK = m;
      }
      if (d1 < d2) {
        r = m;
      } else {
        l = m;
      }
    }
    cout << solV << ' ' << solK << '\n';
  }
}
