#include <bits/stdc++.h>
using namespace std;
long long int maxi(long long int a, long long int b) { return (a > b) ? a : b; }
long long int mini(long long int a, long long int b) { return (a < b) ? a : b; }
long long int lift(long long int a, long long int b) {
  long long int g = 1;
  for (long long int i = 1; i <= b; i++) {
    g *= a;
  }
  return g;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n], mx = 0, mn = 10000000000;
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (long long int i = 1; i < n; i++) {
      if ((a[i] == -1 || a[i - 1] == -1) && (a[i] != -1 || a[i - 1] != -1)) {
        long long int h = maxi(a[i], a[i - 1]);
        mn = mini(mn, h);
        mx = maxi(mx, h);
      }
    }
    mn = mini(mx, mn);
    long long int k = (mn + mx) / 2;
    long long int u = 0;
    for (long long int i = 0; i < n; i++) {
      if (a[i] == -1) a[i] = k;
      if (i) {
        u = maxi(u, abs(a[i] - a[i - 1]));
      }
    }
    cout << u << " " << k << endl;
  }
}
