#include <bits/stdc++.h>
using namespace std;
#define watch2(x , y) cerr<<(#x)<<" = "<<(x)<<" "<<(#y)<<" = "<<(y)<<"\n"
int SD(){int x; scanf("%d" , &x); return x;}
const int AKA = 1e6 + 6 , OO = 1e9;
int a[AKA];
int main()
{
int t = SD();
while(t--)
{
int n = SD() , cnt = 0 , mnV = OO , f = 0;
for(int i = 0 ; i < n ; ++i)
a[i] = SD() , cnt += (a[i] == -1) , a[i] != -1 ? mnV = min(mnV , a[i]) : 0;
for(int i = 0 ; i < n - 1 ; ++i)
if(a[i] != -1 && a[i + 1] != -1)
f = 1;
if(cnt == n)
puts("0 42");
else if(cnt == n - 1)
printf("0 %d\n" , mnV);
else if(f == 1)
{
int m = -1 , k = -1;
for(int i = 0 ; i < n - 1 ; ++i)
if(a[i] != -1 && a[i + 1] != -1)
m = max(m , abs(a[i] - a[i + 1]));
vector<int> v;
for(int i = 0 ; i < n ; ++i)
if(a[i] == -1)
v.push_back(m);
else
v.push_back(a[i]);
for(int i = 0 ; i < v.size() - 1 ; ++i)
k = max(k , abs(v[i] - v[i + 1]));
printf("%d %d\n" , m , k);
}
else
{
vector<int> v;
for(int i = 0 ; i < n ; ++i)
if(a[i] != -1)
v.push_back(a[i]);
int m = -1 , k = -1;
for(int i = 0 ; i < v.size() - 1 ; ++i)
m = max(m , (int)( (v[i] + v[i + 1]) / 2.00));
vector<int> vv;
for(int i = 0 ; i < n ; ++i)
if(a[i] == -1)
vv.push_back(m);
else
vv.push_back(a[i]);
for(int i = 0 ; i < vv.size() - 1 ; ++i)
k = max(k , abs(vv[i] - vv[i + 1]));
printf("%d %d\n" , k , m);
}
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgd2F0Y2gyKHggLCB5KSBjZXJyPDwoI3gpPDwiID0gIjw8KHgpPDwiICAiPDwoI3kpPDwiID0gIjw8KHkpPDwiXG4iCmludCBTRCgpe2ludCB4OyBzY2FuZigiJWQiICwgJngpOyByZXR1cm4geDt9CmNvbnN0IGludCBBS0EgPSAxZTYgKyA2ICwgT08gPSAxZTk7CmludCBhW0FLQV07CmludCBtYWluKCkKewogICAgaW50IHQgPSBTRCgpOwogICAgd2hpbGUodC0tKQogICAgewogICAgICAgIGludCBuICA9IFNEKCkgLCBjbnQgPSAwICwgbW5WID0gT08gLCBmID0gMDsKICAgICAgICBmb3IoaW50IGkgPSAwIDsgaSA8IG4gOyArK2kpCiAgICAgICAgICAgIGFbaV0gPSBTRCgpICwgY250ICs9IChhW2ldID09IC0xKSAsIGFbaV0gIT0gLTEgPyBtblYgPSBtaW4obW5WICwgYVtpXSkgOiAwOwogICAgICAgIGZvcihpbnQgaSA9IDAgOyBpIDwgbiAtIDEgOyArK2kpCiAgICAgICAgICAgIGlmKGFbaV0gIT0gLTEgJiYgYVtpICsgMV0gIT0gLTEpCiAgICAgICAgICAgICAgICBmID0gMTsKICAgICAgICBpZihjbnQgPT0gbikKICAgICAgICAgICAgcHV0cygiMCA0MiIpOwogICAgICAgIGVsc2UgaWYoY250ID09IG4gLSAxKQogICAgICAgICAgICBwcmludGYoIjAgJWRcbiIgLCBtblYpOwogICAgICAgIGVsc2UgaWYoZiA9PSAxKQogICAgICAgIHsKICAgICAgICAgICAgaW50IG0gPSAtMSAsIGsgPSAtMTsKICAgICAgICAgICAgZm9yKGludCBpID0gMCA7IGkgPCBuIC0gMSA7ICsraSkKICAgICAgICAgICAgICAgIGlmKGFbaV0gIT0gLTEgJiYgYVtpICsgMV0gIT0gLTEpCiAgICAgICAgICAgICAgICAgICAgbSA9IG1heChtICwgYWJzKGFbaV0gLSBhW2kgKyAxXSkpOwogICAgICAgICAgICB2ZWN0b3I8aW50PiB2OwogICAgICAgICAgICBmb3IoaW50IGkgPSAwIDsgaSA8IG4gOyArK2kpCiAgICAgICAgICAgICAgICBpZihhW2ldID09IC0xKQogICAgICAgICAgICAgICAgICAgIHYucHVzaF9iYWNrKG0pOwogICAgICAgICAgICAgICAgZWxzZQogICAgICAgICAgICAgICAgICAgIHYucHVzaF9iYWNrKGFbaV0pOwogICAgICAgICAgICBmb3IoaW50IGkgPSAwIDsgaSA8IHYuc2l6ZSgpIC0gMSA7ICsraSkKICAgICAgICAgICAgICAgIGsgPSBtYXgoayAsIGFicyh2W2ldIC0gdltpICsgMV0pKTsKICAgICAgICAgICAgcHJpbnRmKCIlZCAlZFxuIiAsIG0gLCBrKTsKICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgICB2ZWN0b3I8aW50PiB2OwogICAgICAgICAgICAgIGZvcihpbnQgaSA9IDAgOyBpIDwgbiA7ICsraSkKICAgICAgICAgICAgICAgICAgICBpZihhW2ldICE9IC0xKQogICAgICAgICAgICAgICAgICAgICAgICB2LnB1c2hfYmFjayhhW2ldKTsKICAgICAgICAgICAgICBpbnQgbSA9IC0xICwgayA9IC0xOwogICAgICAgICAgICAgIGZvcihpbnQgaSA9IDAgOyBpIDwgdi5zaXplKCkgLSAxIDsgKytpKQogICAgICAgICAgICAgICAgbSA9IG1heChtICwgKGludCkoICh2W2ldICsgdltpICsgMV0pICAvIDIuMDApKTsKICAgICAgICAgICAgICB2ZWN0b3I8aW50PiB2djsKICAgICAgICAgICAgZm9yKGludCBpID0gMCA7IGkgPCBuIDsgKytpKQogICAgICAgICAgICAgICAgaWYoYVtpXSA9PSAtMSkKICAgICAgICAgICAgICAgICAgICB2di5wdXNoX2JhY2sobSk7CiAgICAgICAgICAgICAgICBlbHNlCiAgICAgICAgICAgICAgICAgICAgdnYucHVzaF9iYWNrKGFbaV0pOwogICAgICAgICAgICBmb3IoaW50IGkgPSAwIDsgaSA8IHZ2LnNpemUoKSAtIDEgOyArK2kpCiAgICAgICAgICAgICAgICBrID0gbWF4KGsgLCBhYnModnZbaV0gLSB2dltpICsgMV0pKTsKICAgICAgICAgICAgcHJpbnRmKCIlZCAlZFxuIiAsIGsgLCBtKTsKICAgICAgICB9CiAgICB9Cn0K