#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test;
  cin >> test;
  while (test--) {
    long long n;
    cin >> n;
    long long arr[n];
    for (long long i = 0; i < (long long)n; ++i) cin >> arr[i];
    vector<long long> v;
    for (long long i = 0; i < (long long)n; ++i) {
      if (arr[i] == -1) {
        if (i > 0 && arr[i - 1] != -1) v.push_back(arr[i - 1]);
        if (i < n - 1 && arr[i + 1] != -1) v.push_back(arr[i + 1]);
      }
    }
    if (v.empty()) {
      cout << 0 << " " << 1 << endl;
      continue;
    }
    long double sum = 0, sum2 = 0;
    long long mn = *min_element(v.begin(), v.end());
    long long mx = *max_element(v.begin(), v.end());
    long long k = ((mn) + (mx)) / 2;
    for (long long i = 0; i < (long long)n; ++i) {
      if (arr[i] == -1) arr[i] = k;
    }
    long long mini = -1;
    for (long long i = 1; i < (long long)n; ++i) {
      mini = max(mini, abs(arr[i] - arr[i - 1]));
    }
    cout << mini << " " << k << endl;
  }
  return 0;
}
