{ NOTE: it is recommended to use this even if you don't understand the following code. }

{ constraints }
const
    MAXN = 100000;

{ input data }
var
    T, N, K, i, j   : longint;
    A, B            : array[0..MAXN-1] of longint;
    res             : Int64;
begin
{
    uncomment the following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    readln(T);
    for i:=0 to T-1 do
    begin
        readln(N, K);
        for j:=0 to N-1 do
            readln(A[i], B[i]);

        { insert your code here }

        res := 123456789;
        writeln(res); { print result }
    end;
end.
