#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
int arr[MAXN];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int minv = 1e9 + 1, maxv = -1;
    for (int i = 0; i < n; i++) {
      if (arr[i] == -1) {
        continue;
      }
      bool adj = false;
      if (i > 0 && arr[i - 1] == -1) {
        adj = true;
      }
      if (i < n - 1 && arr[i + 1] == -1) {
        adj = true;
      }
      if (adj) {
        minv = min(minv, arr[i]);
        maxv = max(maxv, arr[i]);
      }
    }
    if (minv == 1e9 + 1) {
      cout << "0 0\n";
      continue;
    }
    int m = 0;
    int k = (minv + maxv) / 2;
    for (int i = 0; i < n - 1; i++) {
      int a = arr[i] == -1 ? k : arr[i];
      int b = arr[i + 1] == -1 ? k : arr[i + 1];
      m = max(m, abs(a - b));
    }
    cout << m << " " << k << "\n";
  }
}
