#include <bits/stdc++.h>
using namespace std;
int t, n;
long long a[200001];
set<long long> s;
int main() {
  cin >> t;
  while (t > 0) {
    t--;
    cin >> n;
    long long dif = -1;
    for (int i = 1; i <= n; i++) cin >> a[i];
    a[n + 1] = -1;
    a[0] = -1;
    for (int i = 1; i <= n; i++)
      if (a[i] == -1) {
        if (a[i - 1] != -1) s.insert(a[i - 1]);
        if (a[i + 1] != -1) s.insert(a[i + 1]);
      } else {
        if (a[i - 1] != -1) dif = max(dif, abs(a[i - 1] - a[i]));
        if (a[i + 1] != -1) dif = max(dif, abs(a[i + 1] - a[i]));
      }
    long long max_el = -1;
    long long min_el = -1;
    if (!s.empty()) {
      max_el = *s.rbegin();
      min_el = *s.begin();
    } else {
      cout << 0 << " " << 0 << '\n';
      continue;
    }
    cout << max(max_el - (max_el + min_el) / 2,
                max(dif, (max_el + min_el) / 2 - min_el))
         << " " << (max_el + min_el) / 2 << '\n';
    s.clear();
  }
  return 0;
}
