#include <bits/stdc++.h>
using namespace std;
int abslt(int n) {
  if (n < 0)
    return -n;
  else
    return n;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n + 1];
    int i;
    for (i = 1; i <= n; i++) cin >> arr[i];
    arr[0] = arr[1];
    arr[n + 1] = arr[n];
    int mx = INT_MIN;
    int mn = INT_MAX;
    for (i = 1; i <= n; i++) {
      if ((arr[i] != -1 && arr[i + 1] == -1) ||
          (arr[i] != -1 && arr[i - 1] == -1)) {
        mx = max(mx, arr[i]);
        mn = min(mn, arr[i]);
      }
    }
    int ans = (mn + mx) / 2;
    if (mx == INT_MIN) {
      cout << 0 << " " << 0 << endl;
      continue;
    }
    int k = INT_MIN;
    for (i = 1; i < n; i++) {
      if (arr[i] == -1) arr[i] = ans;
      if (arr[i + 1] == -1) arr[i + 1] = ans;
      k = max(k, abslt(arr[i] - arr[i + 1]));
    }
    cout << k << " " << ans << endl;
  }
  return 0;
}
