#include <bits/stdc++.h>
using namespace std;
bool comp(long long a, long long b) { return a > b; }
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long maxi = INT_MIN, mi = INT_MAX;
    long long mini = INT_MIN;
    for (int i = 0; i < n; i++) {
      if (a[i] != -1 and i > 0 and a[i - 1] == -1) {
        mi = min(a[i], mi);
        maxi = max(a[i], maxi);
      }
      if (a[i] != -1 and i + 1 < n and a[i + 1] == -1) {
        mi = min(mi, a[i]);
        maxi = max(a[i], maxi);
      }
    }
    long long ans;
    if (mi == INT_MIN) {
      ans = 3;
    } else
      ans = (mi + maxi) / 2;
    for (int i = 0; i < n - 1; i++) {
      if (a[i] != -1 and a[i + 1] != -1) {
        mini = max(mini, abs(a[i] - a[i + 1]));
      }
    }
    for (int i = 0; i < n; i++)
      if (a[i] == -1) a[i] = ans;
    for (int i = 0; i < n - 1; i++) {
      mini = max(mini, abs(a[i] - a[i + 1]));
    }
    cout << mini << " " << ans;
    cout << endl;
  }
}
