#include <bits/stdc++.h>
using namespace std;
int n;
int a[100010];
int R;
int b[100010], B;
void in() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  B = 0;
}
int max(int x, int y) { return x > y ? x : y; }
void solve() {
  int i, j;
  int ans = 0x3f3f3f3f;
  int argmax = -0x3f3f3f3f, argmin = 0x3f3f3f3f;
  for (i = 1; i <= n; i++) {
    if (a[i] != -1 && (a[i - 1] == -1 || a[i + 1] == -1)) {
      b[B++] = a[i];
    }
  }
  sort(b, b + B);
  int ans1 = 0, ans2 = 0;
  if (B != 0) {
    ans2 = (b[0] + b[B - 1]) / 2;
  }
  a[0] = ans2;
  for (i = 1; i <= n; i++) {
    if (a[i] == -1) a[i] = ans2;
    if (i >= 2) ans1 = max(ans1, abs(a[i] - a[i - 1]));
  }
  cout << ans1 << ' ' << ans2 << endl;
}
int main() {
  scanf("%d", &R);
  while (R--) {
    in();
    solve();
  }
  return 0;
}
