#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, i, j, k;
  cin >> t;
  while (t--) {
    int mn = 999999999, mx = -1, n, bs = 0;
    cin >> n;
    int x[n], c = 0;
    for (i = 0; i < n; i++) {
      cin >> x[i];
    }
    for (i = 0; i < n; i++) {
      if (x[i] == -1) {
        c++;
        if (i + 1 < n && x[i + 1] != -1) {
          mx = max(mx, x[i + 1]);
          mn = min(mn, x[i + 1]);
        }
        if (i - 1 >= 0 && x[i - 1] != -1) {
          mx = max(mx, x[i - 1]);
          mn = min(mn, x[i - 1]);
        }
        continue;
      }
      if (x[i + 1] != -1 && i + 1 < n) bs = max(bs, abs(x[i] - x[i + 1]));
    }
    int a, b, nn;
    a = (mx - mn) / 2;
    b = mn + a;
    int ans = max(bs, max(b - mn, mx - b));
    if (c == n)
      cout << 0 << ' ' << 0 << endl;
    else
      cout << ans << ' ' << b << endl;
  }
  return 0;
}
