#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long q, x, y, z, n, m, a[1000000], mn = 1e9, mx = -1e9, ans;
string t;
vector<long long> vec;
set<long long> s;
map<long long, long long> M;
int main() {
  cin >> q;
  while (q--) {
    bool check = false;
    long long ch = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    mx = -1;
    mn = 1e18;
    bool ok = false;
    for (int i = 0; i < n; i++) {
      check = true;
      ch++;
      if (a[i] != -1) {
        check = true;
        ch++;
        if (i == 0) {
          if (a[i + 1] == -1) {
            mx = max(mx, a[i]);
            mn = min(mn, a[i]);
            ok = true;
          }
        } else if (i == n - 1) {
          check = true;
          ch++;
          if (a[i - 1] == -1) {
            mx = max(mx, a[i]);
            mn = min(mn, a[i]);
            ok = true;
          }
        } else {
          check = true;
          ch++;
          if (a[i - 1] == -1 || a[i + 1] == -1) {
            mx = max(mx, a[i]);
            mn = min(mn, a[i]);
            ok = true;
          }
        }
      }
    }
    long long mx2 = -1;
    for (int i = 1; i < n; i++) {
      if (a[i] != -1 && a[i - 1] != -1) mx2 = max(mx2, abs(a[i] - a[i - 1]));
    }
    if (!ok)
      cout << 0 << " " << 1 << endl;
    else {
      x = abs((mx + mn) / 2 - mx);
      y = abs((mx + mn) / 2 - mn);
      x = max(x, y);
      cout << max(mx2, x) << " " << (mx + mn) / 2 << endl;
    }
  }
  return 0;
}
