#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
long long t, n, m, x, y, z, z1, n1, z2, z3, ans;
const int mod = 1000000007;
string s, s1, s2;
long long ar[100005];
vector<long long> v;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    v.clear();
    long long mx = -1, mn = 1e12;
    for (int i = 0; i < n; i++) {
      cin >> ar[i];
      if (ar[i] != -1) {
        mx = max(mx, ar[i]);
        mn = min(ar[i], mn);
      }
    }
    if (mx == -1) {
      cout << "0 0" << endl;
      continue;
    }
    for (int i = 0; i < n; i++) {
      if (ar[i] == -1) {
        if (i > 0 && ar[i - 1] != -1) v.push_back(ar[i - 1]);
        while ((i + 1) < n && ar[i + 1] == -1) i++;
        if ((i + 1) < n) v.push_back(ar[i + 1]);
      }
    }
    mx = -1, mn = 1e12;
    for (int i = 0; i < v.size(); i++) {
      mx = max(mx, v[i]);
      mn = min(v[i], mn);
    }
    m = (mx + mn) / 2;
    for (int i = 0; i < n; i++)
      if (ar[i] == -1) ar[i] = m;
    mx = 0;
    for (int i = 1; i < n; i++) mx = max(mx, abs(ar[i] - ar[i - 1]));
    cout << mx << ' ' << m << endl;
  }
  return 0;
}
