#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
int n, k, ans, Max, Min, f, be;
int top;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    ans = 0;
    Max = -100;
    Min = 2000000000;
    f = 0;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    for (int i = 1; i < n; i++)
      if (a[i] != -1 && a[i + 1] != -1) ans = max(ans, abs(a[i] - a[i + 1]));
    for (int i = 1; i <= n; i++)
      if (a[i] != -1) f = 1;
    for (int i = 1; i <= n; i++) {
      if (a[i] != -1) continue;
      if (i > 1 && a[i - 1] != -1) {
        Max = max(Max, a[i - 1]);
        Min = min(Min, a[i - 1]);
      }
      if (i < n && a[i + 1] != -1) {
        Max = max(Max, a[i + 1]);
        Min = min(Min, a[i + 1]);
      }
    }
    if (!f) {
      printf("0 100\n");
      continue;
    }
    k = Min + (Max - Min) / 2;
    ans = max(ans, Max - k);
    ans = max(ans, k - Min);
    printf("%d %d\n", ans, k);
  }
  return 0;
}
