import std.stdio, std.string, std.conv, std.algorithm;

void main()
{
    foreach(_; 0..readln.chomp.to!int)
    {
        readln;
        int up, down;

        auto inp=readln.split.map!(to!int);
        for(int i; i < inp.length-1; ++i)
        {
            up=max(inp[i+1]-inp[i],up);
            down=min(inp[i+1]-inp[i],down);
        }
        writeln(up, " ", -down);
    }
}