#include <bits/stdc++.h>
using namespace std;
using pll = pair<long long, long long>;
using vl = vector<long long>;
using vpll = vector<pll>;
using mll = map<long long, long long>;
using mcl = map<char, long long>;
using msl = map<string, long long>;
using sl = set<long long>;
using sc = set<char>;
using dl = deque<long long>;
const int N = 1e6 + 5;
long long mod = 1e9 + 7;
vl adj[N];
vpll adjc[N];
long long vis[N];
long long arr[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a, b, c, d, n, m, p, x, y, z, i, j, k,
      f = 0, tc, cnt = 0, sum = 0, mul = 1, mi = 1e18, ma = -1e18;
  string str;
  char ch;
  double db;
  long long l, r;
  cin >> tc;
  while (tc--) {
    cin >> n;
    sum = 0;
    cnt = 0;
    f = 0;
    for (i = 0; i < n; i++) {
      cin >> arr[i];
      if (arr[i] != -1) {
        f = 1;
      }
    }
    if (f == 0) {
      cout << 0 << " " << 0 << "\n";
      continue;
    }
    vl vt;
    for (i = 0; i < n - 1; i++) {
      if (i == 0) {
        if (arr[i] != -1 && arr[i + 1] == -1) {
          vt.push_back(arr[i]);
        }
        continue;
      }
      if (arr[i] != -1 && arr[i - 1] == -1 || arr[i] != -1 && arr[i + 1] == -1)
        vt.push_back(arr[i]);
    }
    if (arr[i] != -1 && arr[i - 1] == -1) vt.push_back(arr[i]);
    sort((vt).begin(), (vt).end());
    x = int((vt).size());
    long long ans;
    ans = (vt[x - 1] + vt[0]) / 2;
    ma = 0;
    for (i = 0; i < n; i++) {
      if (arr[i] == -1) arr[i] = ans;
    }
    for (i = 0; i < n - 1; i++) {
      ma = max(ma, abs(arr[i] - arr[i + 1]));
    }
    cout << ma << " " << ans << "\n";
  }
  return 0;
}
