#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const long long INF_LL = 0x3f3f3f3f3f3f3f3f;
int a[N];
int Abs(int x) { return x > 0 ? x : -x; }
void Solve() {
  int n;
  cin >> n;
  vector<int> b;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (i > 1 && a[i - 1] != -1 && a[i] != -1)
      ans = max(ans, Abs(a[i] - a[i - 1]));
    if (i > 1 && a[i] == -1 && a[i - 1] != -1) b.push_back(a[i - 1]);
    if (i < n && a[i] == -1 && a[i + 1] != -1) b.push_back(a[i + 1]);
  }
  sort(b.begin(), b.end());
  int k = 0;
  if (!b.empty()) {
    int l = b.front(), r = b.back();
    k = l + (r - l) / 2;
    ans = max(ans, max(k - l, r - k));
  }
  cout << ans << ' ' << k << endl;
}
int main() {
  ios::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) Solve();
  return 0;
}
