#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>
std::string printVector(const std::vector<T> &data) {
  std::stringstream ss;
  std::ostream_iterator<T> out_it(ss, ", ");
  ss << "[";
  std::copy(data.begin(), data.end() - 1, out_it);
  ss << data.back() << "]";
  return ss.str();
}
template <typename T>
void print_array(const T &ary, int size) {
  for (int i = (0); i < (size); ++i) {
    cout << ary[i] << " ";
  }
  cout << endl;
}
const int MOD = 1e9 + 7;
const long long LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
signed main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(12);
  int T;
  cin >> T;
  for (int _ = (0); _ < (T); ++_) {
    int N;
    cin >> N;
    vector<long long> A(N);
    bool spe = true;
    for (int i = (0); i < (N); ++i) {
      cin >> A[i];
      if (A[i] != -1) spe = false;
    }
    if (spe) {
      cout << "0 0" << endl;
      continue;
    }
    long long nmax = -1, nmin = LINF;
    long long difmax = -1;
    for (int i = (0); i < (N); ++i) {
      if (A[i] == -1) continue;
      if (i == 0) {
        if (A[1] == -1) {
          chmax(nmax, A[i]);
          chmin(nmin, A[i]);
        } else {
          chmax(difmax, abs(A[1] - A[0]));
        }
      } else if (i == N - 1) {
        if (A[N - 2] == -1) {
          chmax(nmax, A[i]);
          chmin(nmin, A[i]);
        } else {
          chmax(difmax, abs(A[N - 2] - A[N - 1]));
        }
      } else {
        if (A[i - 1] == -1 || A[i + 1] == -1) {
          chmax(nmax, A[i]);
          chmin(nmin, A[i]);
          if (A[i - 1] == -1 && A[i + 1] != -1) {
            chmax(difmax, abs(A[i] - A[i + 1]));
          }
          if (A[i - 1] != -1 && A[i + 1] == -1) {
            chmax(difmax, abs(A[i] - A[i - 1]));
          }
        } else {
          chmax(difmax, abs(A[i] - A[i + 1]));
          chmax(difmax, abs(A[i] - A[i - 1]));
        }
      }
    }
    int K = (nmax + nmin) / 2;
    int M = max(difmax, nmax - K);
    cout << M << " " << K << endl;
  }
}
