#include <bits/stdc++.h>
using namespace std;
void solve() {
  long int n;
  cin >> n;
  long int input;
  vector<long int> v;
  long int minn = INT_MAX;
  long int maxx = INT_MIN;
  int flag = 1;
  for (int i = 0; i < n; i++) {
    cin >> input;
    v.push_back(input);
    if (input != -1) {
      flag = 0;
      minn = min(minn, input);
      maxx = max(maxx, input);
    }
  }
  if (flag == 1) {
    cout << "0 1\n";
    return;
  }
  long int answer = v[0];
  long int global = INT_MAX;
  while (minn <= maxx) {
    long int temp = (minn + maxx) / 2;
    long int maximum = INT_MIN;
    long int number = v[0];
    for (int i = 0; i < n; i++) {
      if (v[i] == -1) {
        if (i + 1 < n and v[i + 1] >= 0 and abs(v[i + 1] - temp) > maximum) {
          maximum = abs(v[i + 1] - temp);
          number = v[i + 1];
        }
        if (i - 1 >= 0 and v[i - 1] >= 0 and abs(v[i - 1] - temp) > maximum) {
          maximum = abs(v[i - 1] - temp);
          number = v[i - 1];
        }
      }
    }
    if (maximum < global) {
      global = maximum;
      answer = temp;
    }
    if (number == temp) {
      global = 0;
      answer = number;
      break;
    }
    if (number > temp) {
      minn = temp + 1;
    } else if (number < temp) {
      maxx = temp - 1;
    }
  }
  for (int i = 0; i < n; i++)
    if (v[i] == -1) v[i] = answer;
  for (int i = 0; i < n - 1; i++) {
    if (abs(v[i + 1] - v[i]) > global) global = abs(v[i + 1] - v[i]);
  }
  cout << global << " " << answer << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
