#include <bits/stdc++.h>
using namespace std;
const long long int inf = LLONG_MAX;
const long long int mod = 1e9 + 7;
const long double pi = acos(-1);
void solution() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  long long int mx = 0;
  long long int mn = inf;
  long long int cnt = 0;
  for (int i = 0; i < n; i++) {
    if ((i > 0 && a[i] != -1 && a[i - 1] == -1) ||
        (i < n && a[i] != -1 && a[i + 1] == -1)) {
      mx = max(mx, a[i]);
      mn = min(mn, a[i]);
      cnt++;
    }
  }
  if (cnt == 0) {
    cout << 0 << " " << 1;
    return;
  }
  long long int val = (mx + mn) / 2;
  for (int i = 0; i < n; i++) {
    if (a[i] == -1) {
      a[i] = val;
    }
  }
  long long int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    ans = max(ans, abs(a[i] - a[i + 1]));
  }
  cout << ans << " " << val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  t = 1;
  cin >> t;
  while (t--) {
    solution();
    cout << "\n";
  }
  return 0;
}
