//Задача "Дороги, дороги..."
//7-я интернет-олимпиада сезона 2008-2009, усложненный уровень
//Автор задачи: Федор Царев, tsarev@rain.ifmo.ru
//Автор решения: Максим Буздалов, buzdalov@rain.ifmo.ru

//Использует 30 итераций двоичного поиска. 
//Не хватает для достижения необходимой точности ответа.
//Не проверяет корректность входных данных.

uses
  sysutils;
  
type double = extended;

const EPS = 1e-2;

function isZero(value, eps: double) : boolean;
begin
    result := (-eps <= value) and (value <= eps);
end;

function length(x1, y1, x2, y2: double) : double;
begin
    result := sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
end;

function side(pX, pY, lX1, lY1, lX2, lY2: double) : integer;
var
    vmul: double;
begin
    vmul := (pX - lX1) * (lY2 - lY1) - (pY - lY1) * (lX2 - lX1);
    if isZero(vmul, 1e-9) then begin
        result := 0;
    end else if vmul < 0 then begin
        result := -1;
    end else begin
        result := 1;
    end;
end;

function disbalance(sX1, sY1, sX2, sY2, lX1, lY1, lX2, lY2: double) : double;
var
    signum1, signum2            : integer;
    segmentLength               : double;
    dx1, dy1, dx2, dy2, ax, ay  : double;
    det, t                      : double;
    ix, iy                      : double;
begin
    segmentLength := length(sX1, sY1, sX2, sY2);
    
    signum1 := side(sX1, sY1, lX1, lY1, lX2, lY2);
    signum2 := side(sX2, sY2, lX1, lY1, lX2, lY2);
    if abs(signum1 - signum2) < 2 then begin
    
        { either no intersection with line, 
          or one common point (up to EPS), 
          or segment belongs to line. }
        
        if signum1 + signum2 > 0 then begin
            result := segmentLength;
        end else if signum1 + signum2 < 0 then begin
            result := -segmentLength;
        end else begin
            result := 0;
        end;
    end else begin
        
        { segment and line have intersection. }
        
        dx1 := sX2 - sX1;
        dy1 := sY2 - sY1;
        dx2 := lX1 - lX2;
        dy2 := lY1 - lY2;
        ax  := lX1 - sX1;
        ay  := lY1 - sY1;
        
        det := dx1 * dy2 - dy1 * dx2;
        
        if isZero(det, 1e-9) then begin
            { strange... should almost never happen. }
            result := 0;
        end else begin
            t := (ax * dy2 - ay * dx2) / det;
        
            ix := sX1 + dx1 * t;
            iy := sY1 + dy1 * t;
        
            if signum1 > 0 then begin
                result := length(sX1, sY1, ix, iy) - length(ix, iy, sX2, sY2);
            end else begin
                result := length(sX2, sY2, ix, iy) - length(ix, iy, sX1, sY1);
            end;
        end;
    end;
end;

const
    cosa = 0.763424234423;
    sina = sqrt(1 - cosa * cosa);

var
    inx, iny            : longint;
    xs, ys              : array[1 .. 100000] of double;
    src, trg            : array[1 .. 100000] of longint;
    len                 : array[1 .. 100000] of double;
    pointCount          : longint;
    edgeCount           : longint;
    balance             : double;
    i, it               : longint;
    lX1, lY1, lX2, lY2,
        lX3, lY3        : double;
    left, right, mid    : double;
    lx, rx,  tmp        : double;

begin
    assign(input, 'roads.in');
    assign(output, 'roads.out');
    reset(input);
    rewrite(output);
        
    readln(pointCount, edgeCount);
    for i := 1 to pointCount do begin
        readln(inx, iny);
        xs[i] := inx * cosa - iny * sina;
        ys[i] := inx * sina + iny * cosa;
    end;
    for i := 1 to edgeCount do begin
        readln(src[i], trg[i]);
        len[i] := length(xs[src[i]], ys[src[i]], xs[trg[i]], ys[trg[i]]);
    end;
    
    left := -2e4;
    right := 2e4;
    
    balance := 0;
    
    for it := 1 to 30 do begin
        balance := 0;
        mid := (left + right) / 2;
        for i := 1 to edgeCount do begin
            lx := xs[src[i]];
            rx := xs[trg[i]];
            if lx > rx then begin
                tmp := lx;
                lx := rx;
                rx := tmp;
            end;
            if not isZero(lx - rx, 1e-6) then begin
                if (lx < mid) and (rx > mid) then begin
                    balance := balance + ((mid - lx) - (rx - mid)) * len[i] / (rx - lx);
                end else if (rx < mid + EPS) then begin
                    balance := balance + len[i];
                end else if (lx > mid - EPS) then begin
                    balance := balance - len[i];
                end;
            end;
        end;
        if abs(balance) < 1e-9 then begin
            break;
        end;
        if balance > 0 then begin
            right := mid;
        end else begin
            left := mid;
        end;
    end;
    
    lX1 := ((right + left) / 2) * cosa + 0 * sina;
    lY1 := 0 * cosa - ((right + left) / 2) * sina;
    lX2 := ((right + left) / 2) * cosa + 1 * sina;
    lY2 := 1 * cosa - ((right + left) / 2) * sina;
    lX3 := ((right + left) / 2) * cosa + (-1) * sina;
    lY3 := (-1) * cosa - ((right + left) / 2) * sina;
    
    if (abs(lX2) < 1e3 + EPS) and (abs(lY2) < 1e3 + EPS) then begin
        writeln(lX1, ' ', lY1);
        writeln(lX2, ' ', lY2);
    end else begin
        writeln(lX1, ' ', lY1);
        writeln(lX3, ' ', lY3);
    end;
end.
