#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int a[maxn];
int main(int argc, char const *argv[]) {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
    }
    vector<int> v;
    for (int i = 1; i <= n; ++i) {
      if (a[i] == -1) {
        if (a[i + 1] != -1) {
          if (i + 1 <= n) {
            v.push_back(a[i + 1]);
          }
        }
        if (a[i - 1] != -1) {
          if (i - 1 >= 1) {
            v.push_back(a[i - 1]);
          }
        }
      }
    }
    int ans = 0;
    for (int i = 2; i <= n; ++i) {
      if (a[i] != -1 && a[i - 1] != -1) {
        ans = max(ans, abs(a[i] - a[i - 1]));
      }
    }
    if (v.empty()) {
      printf("%d 0\n", ans);
      continue;
    }
    sort(v.begin(), v.end());
    int k = (v.back() + v[0]) / 2;
    for (int i = 1; i <= n; ++i)
      if (a[i] == -1) a[i] = k;
    for (int i = 2; i <= n; ++i) {
      ans = max(ans, abs(a[i] - a[i - 1]));
    }
    printf("%d %d\n", ans, k);
  }
  return 0;
}
