#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int inf = 1000 * 1000 * 1000;
const int mod = 998244353;
mt19937 myrand(chrono::steady_clock::now().time_since_epoch().count());
int t;
int n;
int a[N];
int main() {
  cin >> t;
  while (t--) {
    scanf("%d", &n);
    int mn = inf + 1, mx = -1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i <= n; i++) {
      if (a[i] != -1) {
        if (i > 1 && a[i - 1] == -1 || i < n && a[i + 1] == -1) {
          mx = max(mx, a[i]);
          mn = min(mn, a[i]);
        }
      }
    }
    int k = (mx + mn) / 2;
    for (int i = 1; i <= n; i++) {
      if (a[i] == -1) {
        a[i] = k;
      }
    }
    int pat = 0;
    for (int i = 2; i <= n; i++) {
      pat = max(pat, abs(a[i] - a[i - 1]));
    }
    printf("%d %d\n", pat, k);
  }
  return 0;
}
