#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int inp[n + 2];
    inp[0] = inp[n + 1] = -1;
    for (int i = 1; i <= n; i++) cin >> inp[i];
    int mi = INT_MAX, ma = INT_MIN, m = 0;
    for (int i = 1; i <= n; i++) {
      if (inp[i] == -1) {
        if (inp[i + 1] != -1) {
          mi = min(inp[i + 1], mi);
          ma = max(inp[i + 1], ma);
        }
        if (inp[i - 1] != -1) {
          mi = min(inp[i - 1], mi);
          ma = max(inp[i - 1], ma);
        }
      } else {
        if (inp[i - 1] != -1) m = max(abs(inp[i] - inp[i - 1]), m);
      }
    }
    int k = (mi + ma) / 2;
    m = max(m, max(k - mi, ma - k));
    cout << m << " " << k << "\n";
  }
  return 0;
}
