#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vi = vector<int>;
const long long inf = 2e9;
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long t;
  cin >> t;
  for (long long ij = 0; ij < t; ij++) {
    long long n;
    cin >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long mx = -1, mn = inf, ma = 0;
    bool fl = false;
    for (long long i = 0; i < n; i++) {
      if (a[i] == -1) {
        if (i > 0 && a[i - 1] >= 0)
          mx = max(mx, a[i - 1]), mn = min(mn, a[i - 1]);
        if (i + 1 < n && a[i + 1] >= 0)
          mx = max(mx, a[i + 1]), mn = min(mn, a[i + 1]);
      } else {
        fl = true;
        if (i > 0 && a[i - 1] >= 0) ma = max(ma, abs(a[i] - a[i - 1]));
        if (i + 1 < n && a[i + 1] >= 0) ma = max(ma, abs(a[i] - a[i + 1]));
      }
    }
    if (!fl)
      cout << 0 << ' ' << 1 << '\n';
    else
      cout << max((mx - mn + 1) / 2, ma) << ' ' << mn + (mx - mn + 1) / 2
           << '\n';
  }
}
