// Задача "Арифметическая прогрессия"
// 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, last, cnt, first : int;

begin
    cnt := 1;

    last := a[ind];
    for i := ind - 1 downto 1 do begin
        if (last - a[i] = d) then begin
            last := a[i];
            cnt := cnt + 1
        end;
    end;
    first := last;

    last := a[ind];
    for i := ind + 1 to n do begin
        if (a[i] - last = d) then begin
            last := a[i];
            cnt := cnt + 1;
        end;
    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);
        while i2 = i1 do begin
            i2 := 1 + random(n);
        end;

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