#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  long long a[n], i, mn = 10000000005, mx = 0, d;
  for (i = 0; i < n; i++) cin >> a[i];
  long long c = 0;
  for (i = 0; i < n; i++) {
    if (a[i] != -1 && (a[i - 1] == -1 || a[i + 1] == -1)) {
      mn = min(mn, a[i]);
      mx = max(mx, a[i]);
    }
    if (a[i] != -1) c = 1;
  }
  long long t = 0, m;
  m = (mx + mn + 1) / 2;
  for (i = 0; i < n - 1; i++) {
    if (a[i] == -1) a[i] = m;
    if (a[i + 1] == -1) a[i + 1] = m;
    t = max(t, abs(a[i] - a[i + 1]));
  }
  if (c == 0)
    cout << 0 << " " << 4 << endl;
  else
    cout << t << " " << m << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
