#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n + 2);
    for (int i = 1; i <= n; i++) cin >> v[i];
    int mi = 1e9, ma = -1e9, val, ans = 0;
    for (int i = 1; i <= n; i++) {
      if (v[i] != -1 && (v[i - 1] == -1 || v[i + 1] == -1))
        mi = min(mi, v[i]), ma = max(ma, v[i]);
    }
    val = (mi + ma) / 2;
    if (v[1] == -1) v[1] = val;
    for (int i = 2; i <= n; i++) {
      if (v[i] == -1) v[i] = val;
      ans = max(ans, abs(v[i] - v[i - 1]));
    }
    cout << ans << ' ' << val << '\n';
  }
}
