#include <bits/stdc++.h>
const int maxn = 2e5 + 9;
const int mod = 1e9 + 7;
using namespace std;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, i, a[maxn] = {0}, b[maxn] = {0}, cnt = 0, m = 0;
    scanf("%d", &n);
    for (i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (i = 1; i <= n; i++) {
      if (a[i] != -1) {
        if (a[i - 1] == -1 || a[i + 1] == -1) {
          b[++cnt] = a[i];
        }
      }
    }
    for (i = 2; i <= n; i++) {
      if (a[i] != -1 && a[i - 1] != -1) m = max(m, abs(a[i] - a[i - 1]));
    }
    if (!cnt) {
      printf("0 0\n");
      continue;
    }
    sort(b + 1, b + 1 + cnt);
    printf("%d %d\n", max(m, b[cnt] - (b[cnt] + b[1]) / 2),
           (b[cnt] + b[1] + 1) / 2);
  }
}
