#include <bits/stdc++.h>
using namespace std;
const int INF = 1061109567;
const long long LINF = 4557430888798830399ll;
const int MOD = 1000000007;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + (c - '0');
    c = getchar();
  }
  return x * f;
}
int qpow(long long x, int n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
int a[100005];
void test_case() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int minval = INF, maxval = -INF;
  int ans = 0;
  for (int i = 2; i <= n; ++i) {
    if (a[i - 1] == -1 && a[i] != -1) {
      minval = min(minval, a[i]);
      maxval = max(maxval, a[i]);
    }
    if (a[i - 1] != -1 && a[i] == -1) {
      minval = min(minval, a[i - 1]);
      maxval = max(maxval, a[i - 1]);
    }
    if (a[i - 1] != -1 && a[i] != -1) ans = max(ans, abs(a[i] - a[i - 1]));
  }
  ans = max(ans, (maxval - minval + 1) / 2);
  printf("%d %d\n", ans, (maxval + minval) / 2);
}
int main() {
  int t = 1;
  scanf("%d", &t);
  for (int i = 1; i <= t; ++i) {
    test_case();
  }
}
