// Задача "Арифметическая прогрессия"
// XI Всероссийская командная олимпиада школьников по программированию
// Автор задачи: Андрей Станкевич
// Автор решения: Владимир Ульянцев, ulyantsev@rain.ifmo.ru

uses
    SysUtils, Math;
type
    int = longint;
const
    MAXN = 100000;
    MAXX = 1000000000;
var
    i, j, n, i1, i2, diff, sign : int;
    a : array [1..2 * MAXN] of int;

procedure check(ind, d : int);
var
    i, cnt, first, max, min : int;
    was : array [-2 * MAXN - 1 .. 2 * MAXN + 1] of boolean;
begin
    if (d = 0) then begin
        cnt := 0;
        first := a[ind];
        for i := 1 to n do begin
            if (a[i] = a[ind]) then begin
                cnt := cnt + 1;
            end;
        end;
    end else begin
        fillchar(was, sizeof(was), 0);
        for i := 1 to n do begin
            if ((a[i] - a[ind]) mod d = 0) and (abs((a[i] - a[ind]) div d) <= 2 * MAXN) then begin
                was[(a[i] - a[ind]) div d] := true;
            end;
        end;
      
        min := 0;
        while (was[min - 1]) do
            min := min - 1;
        max := 0;
        while (was[max + 1]) do
            max := max + 1;

        cnt := max - min + 1;
        first := a[ind] + d * min;
    end;

    if (cnt * 2 >= n) then begin
        rewrite(output, 'arithm.out');
        writeln(first, ' ', d);
        close(output);
        halt;
    end;
end;

begin
    reset(input, 'arithm.in');

    read(n);
    assert((1 <= n) and (n <= MAXN));
    n := 2 * n;

    for i := 1 to n do begin
        read(a[i]);
        assert((-MAXX <= a[i]) and (a[i] <= MAXX));
    end;

    close(input);


    while (true) do begin
        i1 := 1 + random(n);
        i2 := 1 + random(n);

        diff := abs(a[i2] - a[i1]);
        if diff <> 0 then begin
            for j := 1 to floor(sqrt(diff)) do begin
                if diff mod j = 0 then begin
                    check(i1, j);
                    check(i1, diff div j);
                end;
            end;
        end else begin
            check(i1, 0); 
        end;
    end;
end.
