#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    int ma = -1, mi = 1e9 + 10;
    cin >> n;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
      if (a[i] == -1) {
        if (i != 0) {
          if (a[i - 1] != -1) {
            mi = min(a[i - 1], mi);
            ma = max(a[i - 1], ma);
          }
        }
        if (i != n - 1) {
          if (a[i + 1] != -1) {
            mi = min(a[i + 1], mi);
            ma = max(a[i + 1], ma);
          }
        }
      }
    }
    if (ma == -1 && mi == 1e9 + 10) {
      cout << 0 << ' ' << 0 << '\n';
    } else if (mi == ma) {
      int m = 0;
      for (int i = 0; i < n; ++i) {
        if (a[i] == -1) {
          a[i] = mi;
        }
        if (i) m = max(m, abs(a[i] - a[i - 1]));
      }
      cout << m << ' ' << mi << '\n';
    } else {
      int mid = (mi + ma) / 2;
      int m = 0;
      for (int i = 0; i < n; ++i) {
        if (a[i] == -1) {
          a[i] = mid;
        }
        if (i) m = max(m, abs(a[i] - a[i - 1]));
      }
      cout << m << ' ' << mid << '\n';
    }
  }
  return 0;
}
