uses testlib;
{$R+,Q+}

const MaxShip = 10;
      eps = 1.5e-3;
type
    TShip = record
        x, y : integer;
        vx, vy : integer;
    end;
    TShipArray = array [1..MaxShip] of TShip;
    TShipSet = set of byte;

var
    n, r, i, num, t, k : integer;
    ship : TShipArray;
    dest : TShipSet;
    x0, y0 : extended;
    a:integer;


    function lesseq (a, b : extended) : boolean; begin
        result := b>(a-eps);
    end;


    function dist2 (x1, y1, x2, y2 : extended) : extended; begin
        result := (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
    end;

    function checkShips (t : integer; x0, y0 : extended) : TShipSet;
        var i : integer;
            sx, sy : extended;
            tt:extended
;
        begin
            result := [];
            for i := 1 to n do begin
                tt:=t;
                sx := ship[i].x + ship[i].vx*tt;
                sy := ship[i].y + ship[i].vy*tt;
                if lesseq (dist2(sx,sy,x0,y0),(R+eps)*(R+eps)) then result := result + [i];
            end;
        end;

begin
    a := ans.ReadInteger;
    n := inf.ReadInteger;
    r := inf.ReadInteger;
    for i := 1 to n do begin
        ship[i].x := inf.ReadLongint;
        ship[i].y := inf.ReadLongint;
        ship[i].vx := inf.ReadLongint;
        ship[i].vy := inf.ReadLongint;
    end;
    num := ouf.ReadInteger;
    if num>n then quit(_WA,'Too many shots');
    if num>0 then begin
        dest := [];
        for i := 1 to num do begin
            t := ouf.ReadLongint;
            if (t >= 0) and (t<=1000000000) then begin
                x0 := ouf.ReadReal;
                y0 := ouf.ReadReal;
                dest := dest + checkShips(t, x0, y0);
            end
              else Quit(_PE, '# Time must be a positive number.')
        end;
        if dest = [1..n] then begin
          if a=num then Quit (_OK, '')
               else if a<num then quit(_WA,'Count of shots is not optimal')
                    else  quit(_Fail,'Solution is better then answer');
          end   
          else Quit (_WA, '# Some ships had not been destroyed.')
    end
      else Quit (_WA, '# Number of shots is not enough.');
end.
