#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long a[maxn];
int solve() {
  long long n, cnt(0), mn = 1e18, mx = 0;
  scanf("%lld", &n);
  for (int i = 1; i < n + 1; ++i) {
    scanf("%lld", &a[i]);
    if (a[i] == -1) {
      if (i > 1 && a[i - 1] != -1)
        mx = max(mx, a[i - 1]), mn = min(mn, a[i - 1]);
    } else {
      if (i > 1 && a[i - 1] == -1) mx = max(mx, a[i]), mn = min(mn, a[i]);
      cnt++;
    }
  }
  if (!cnt) return puts("0 0");
  long long sum = mn + mx >> 1;
  long long xm(-1);
  for (int i = 1; i < n + 1; ++i) {
    if (a[i] == -1) a[i] = sum;
    if (i > 1) xm = max(xm, abs(a[i] - a[i - 1]));
  }
  return printf("%lld %lld\n", xm, sum);
}
int main() {
  int _;
  scanf("%d", &_);
  while (_--) solve();
}
