#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long i, j = 0, kk;
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (i = 0; i < n; i++) cin >> v[i];
    set<long long> s;
    for (i = 0; i < n; i++) {
      if (v[i] == -1) {
        if (i != 0 && v[i - 1] != -1) s.insert(v[i - 1]);
        if (i != n - 1 && v[i + 1] != -1) s.insert(v[i + 1]);
      } else if (i != 0 && v[i - 1] != -1) {
        j = max(j, abs(v[i] - v[i - 1]));
      }
    }
    if (s.size() == 0) {
      cout << j << " " << 0 << endl;
    } else if (s.size() == 1) {
      cout << j << " " << *s.begin() << endl;
    } else {
      long long y, x = *s.begin();
      set<long long>::iterator it;
      for (it = s.begin(); it != s.end(); it++) y = *it;
      x = (x + y) / 2;
      cout << max(j, y - x) << " " << x << endl;
    }
  }
}
