#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
int to(int x, int y) { return (x * 60) + (y); }
string to_string(long long a) {
  stringstream ss;
  ss << a;
  string str = ss.str();
  return str;
}
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long double dist(pair<double, pair<double, pair<double, double> > > a,
                 pair<double, pair<double, pair<double, double> > > b) {
  return (
      ((a.first - b.first) * (a.first - b.first)) +
      ((a.second.first - b.second.first) * (a.second.first - b.second.first)) +
      ((a.second.second.first - b.second.second.first) *
       (a.second.second.first - b.second.second.first)));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    int s = 0, e = 1e9, ans = 1e9, k;
    while (s <= e) {
      int mid1 = s + (e - s) / 3;
      int mid2 = e - (e - s) / 3;
      int def1 = -1e9, def2 = -1e9;
      for (int i = 0; i < n - 1; i++) {
        if (arr[i] == -1) {
          if (arr[i + 1] == -1)
            def1 = max(0, def1), def2 = max(0, def2);
          else
            def1 = max(abs(arr[i + 1] - mid1), def1),
            def2 = max(abs(arr[i + 1] - mid2), def2);
        } else if (arr[i + 1] == -1)
          def1 = max(abs(arr[i] - mid1), def1),
          def2 = max(abs(arr[i] - mid2), def2);
        else
          def1 = max(abs(arr[i + 1] - arr[i]), def1),
          def2 = max(abs(arr[i + 1] - arr[i]), def2);
      }
      if (def1 >= def2) {
        s = mid1 + 1;
        if (def2 < ans) {
          ans = def2;
          k = mid2;
        }
      } else {
        e = mid2 - 1;
        if (def1 < ans) {
          ans = def1;
          k = mid1;
        }
      }
    }
    cout << ans << ' ' << k << endl;
  }
  cout << endl;
  return 0;
}
