#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  long long int p = sqrt(n);
  for (int i = 5; i <= p; i += 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int b2d(string n) {
  string num = n;
  long long int dec_value = 0;
  long long int base = 1;
  long long int len = num.length();
  for (int i = len - 1; i >= 0; i--) {
    if (num[i] == '1') dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
int f, f1, f2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    f = 0;
    int a[n];
    int cnt = 0, sum = 0;
    int m1 = 0, m2 = INT_MAX;
    for (long long i = 0; i < n; i++) {
      cin >> a[i];
      if (a[i] != -1) f = 1;
    }
    for (long long i = 0; i < n; i++) {
      if (a[i] != -1) {
        if ((i > 0 && a[i - 1] == -1) || (i < n - 1 && a[i + 1] == -1)) {
          m1 = max(m1, a[i]);
          m2 = min(m2, a[i]);
        }
      }
    }
    if (!f) {
      cout << "0 1\n";
      continue;
    }
    int avg1 = (m1 + m2) / 2;
    for (long long i = 0; i < n; i++) {
      if (a[i] == -1) {
        a[i] = avg1;
      }
    }
    int ma1 = 0;
    for (long long i = 0; i < n - 1; i++) {
      ma1 = max(ma1, abs(a[i + 1] - a[i]));
    }
    cout << ma1 << " " << avg1 << endl;
  }
}
