#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const double PI = acos(-1.0);
using namespace std;
const double EPS = 1e-9;
const int N = 5e5 + 9;
int n, a[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    int mn = -1, mx = -1;
    for (int i = 1; i <= n; i++) {
      if (a[i] != -1 &&
          ((i - 1 > 0 && a[i - 1] == -1) || (i + 1 <= n && a[i + 1] == -1))) {
        if (mn == -1)
          mn = mx = a[i];
        else {
          mn = min(mn, a[i]);
          mx = max(mx, a[i]);
        }
      }
    }
    if (mn == -1)
      cout << "0 1\n";
    else {
      int k = (mx + mn) / 2;
      for (int i = 1; i <= n; i++)
        if (a[i] == -1) a[i] = k;
      int m = 0;
      for (int i = 2; i <= n; i++) {
        m = max(m, abs(a[i] - a[i - 1]));
      }
      cout << m << " " << k << endl;
    }
  }
  return 0;
}
