#include <bits/stdc++.h>
using namespace std;
double doINF = 1.0 / 0.0;
ostream_iterator<int> outp(cout, " ");
inline long long modadd(long long n, long long m, long long mod) {
  long long sum = ((n + m) % mod + mod) % mod;
  return sum;
}
inline long long modsub(long long n, long long m, long long mod) {
  long long diff = ((n - m + mod) % mod + mod) % mod;
  return diff;
}
inline long long modpro(long long n, long long m, long long mod) {
  long long pro = ((n * m) % mod + mod) % mod;
  return pro;
}
inline long long pow(int x, int y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
inline long long powmod(long long x, long long y, long long mod) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = modpro(res, x, mod);
    y = y >> 1;
    x = modpro(x, x, mod);
  }
  return res;
}
long long min(long long a, long long b) {
  if (a > b) {
    return b;
  }
  return a;
}
long long max(long long a, long long b) {
  if (a > b) {
    return a;
  } else
    return b;
}
bool pairdec(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first)
    return (a.first > b.first);
  else
    return a.second > b.second;
}
long long power(long long x, long long y, long long mod) {
  long long res = 1;
  x = x % mod;
  while (y > 0) {
    if (y & 1) res = (res * x) % mod;
    y = y >> 1;
    x = (x * x) % mod;
  }
  return res;
}
long long modInverse(long long a, long long mod) {
  return powmod(a, mod - 2, mod);
}
long long modFact(long long n, long long mod) {
  if (n >= mod) return 0;
  long long result = 1;
  for (long long i = 1; i <= n; i++) result = (result * i) % mod;
  return result;
}
bool comp(const pair<int, int> pia, const pair<int, int> pib) {
  if (pia.first == pib.first)
    return pia.second > pib.second;
  else
    return pia.first > pib.first;
}
const int N = 1e9 + 7;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    vector<int> v;
    for (int i = 0; i < n; i++) {
      if (arr[i] == -1) {
        if (i - 1 >= 0) {
          if (arr[i - 1] != -1) v.push_back(arr[i - 1]);
        }
        if (i + 1 <= n - 1) {
          if (arr[i + 1] != -1) v.push_back(arr[i + 1]);
        }
      }
    }
    if (v.size() == 0) {
      cout << "0 0"
           << "\n";
      continue;
    }
    sort(v.begin(), v.end());
    int val = (v[0] + v[v.size() - 1]) / 2;
    for (int i = 0; i < n; i++) {
      if (arr[i] == -1) arr[i] = val;
    }
    int maxi = -1;
    for (int i = 0; i < n - 1; i++) {
      if (abs(arr[i] - arr[i + 1]) >= maxi) maxi = abs(arr[i] - arr[i + 1]);
    }
    cout << maxi << " " << val << "\n";
  }
}
