#include <bits/stdc++.h>
using namespace std;
int t, n;
int v[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    int MIN = INT_MAX, MAX = -1;
    for (int i = 1; i <= n; ++i) cin >> v[i];
    for (int i = 1; i <= n; ++i) {
      if (v[i - 1] == -1 || v[i + 1] == -1) {
        if (v[i] == -1) continue;
        MIN = min(MIN, v[i]);
        MAX = max(MAX, v[i]);
      }
    }
    int k = (MIN + MAX) / 2, rez = -1;
    for (int i = 1; i <= n; ++i) {
      if (v[i] == -1) v[i] = k;
    }
    for (int i = 1; i < n; ++i) {
      int sum = fabs(v[i] - v[i + 1]);
      rez = max(rez, sum);
    }
    if (MIN == INT_MAX)
      cout << "0 0\n";
    else
      cout << rez << " " << k << '\n';
  }
  return 0;
}
