#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mod = 998244353;
const int inf = 1e9;
const double eps = 1e-16;
const double pi = acos(-1);
inline int read() {
  int p = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    p = p * 10 + ch - '0';
    ch = getchar();
  }
  return p * f;
}
int a[N], n, b[N], blen = 0;
int main() {
  int t = read();
  while (t--) {
    n = read();
    int lst = 0;
    int ans = 0;
    for (int i = 1; i <= n; i++) a[i] = read();
    blen = 0;
    for (int i = 1; i <= n; i++)
      if (a[i] >= 0 && ((a[i - 1] == -1) || (a[i + 1] == -1))) b[++blen] = a[i];
    sort(b + 1, b + blen + 1);
    int s = 0;
    for (int i = 1; i < n; i++)
      if (a[i] >= 0 && a[i + 1] >= 0) s = max(s, abs(a[i] - a[i + 1]));
    if (blen == 0)
      ans = 0;
    else
      ans = (b[blen] + b[1]) / 2,
      s = max(s, max(abs(b[blen] - ans), abs(b[1] - ans)));
    printf("%d %d\n", s, ans);
    for (int i = 1; i <= n; i++) a[i] = 0;
  }
  return 0;
}
