#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t, n, a, prev;
  cin >> t;
  while (t--) {
    cin >> n >> a;
    prev = a;
    int mini = 1e9 + 1, maxi = -1, ans = -1;
    for (int i = 2; i <= n; i++) {
      cin >> a;
      if (prev == -1) {
        if (a != -1) {
          mini = min(mini, a);
          maxi = max(maxi, a);
        }
      } else {
        if (a == -1) {
          mini = min(mini, prev);
          maxi = max(maxi, prev);
        } else
          ans = max(ans, abs(a - prev));
      }
      prev = a;
    }
    if (mini == 1e9 + 1)
      cout << "0 0\n";
    else
      cout << max(ans, max(maxi - (mini + maxi) / 2, (mini + maxi) / 2 - mini))
           << " " << (mini + maxi) / 2 << '\n';
  }
  return 0;
}
