#include <bits/stdc++.h>
using namespace std;
long long mn = INT_MAX;
bool myfnc(const pair<long long, long long>& a,
           const pair<long long, long long>& b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
template <typename K, typename V>
void print_map(std::map<K, V> const& m) {
  for (auto const& pair : m) {
    std::cout << pair.first << ":" << pair.second << "\n";
  }
}
void solve() {
  int n;
  cin >> n;
  int a[n + 5];
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  int maxx = -INT_MAX;
  int mn = INT_MAX;
  a[0] = 0;
  a[n + 1] = 0;
  for (int i = 1; i < n + 1; i++) {
    if ((a[i - 1] == -1 || a[i + 1] == -1) && a[i] != -1) {
      maxx = max(maxx, a[i]);
      mn = min(mn, a[i]);
    }
  }
  int b = (maxx + mn) / 2;
  replace(a, a + n + 1, -1, b);
  mn = INT_MAX;
  maxx = -INT_MAX;
  for (int i = 1; i < n; i++) {
    int tmp = abs(a[i] - a[i + 1]);
    maxx = max(tmp, maxx);
  }
  cout << maxx << " " << b << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
