#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1 * 1e5 + 70;
const long long MOD = 1e9 + 9;
vector<int> tab;
int N, M;
void init() {
  cin >> N;
  tab.resize(N);
  for (int i = 0; i < N; i++) cin >> tab[i];
}
void prepare() {}
void solve() {
  int mx = -1;
  int mi = 1e9 + 12;
  for (int i = 0; i < N; i++) {
    if (tab[i] == -1) {
      if (i != 0)
        if (tab[i - 1] != -1) {
          mx = max(mx, tab[i - 1]);
          mi = min(mi, tab[i - 1]);
        }
      if (i != N - 1)
        if (tab[i + 1] != -1) {
          mx = max(mx, tab[i + 1]);
          mi = min(mi, tab[i + 1]);
        }
    }
  }
  int k = (mx + mi) / 2;
  if (mx == -1) k = 0;
  int dif = 0;
  if (tab[0] == -1) tab[0] = k;
  for (int i = 1; i < N; i++) {
    if (tab[i] == -1) tab[i] = k;
    dif = max(dif, abs(tab[i - 1] - tab[i]));
  }
  cout << dif << " " << k << "\n";
}
int main() {
  if (!false) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  if (true) {
    int t;
    cin >> t;
    while (t--) {
      init();
      prepare();
      solve();
    }
  } else {
    init();
    prepare();
    solve();
  }
  return 0;
}
