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

const
    MAXS = 50;
    MAXN = 100000;

var
    N, S, ans, i       : LongInt;
    X_1, X_2, Y_1, Y_2 : Array[0..MAXS-1] of LongInt;
    x1, x2, y1, y2     : Array[0..MAXN-1] of LongInt;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(S);

    for i:=0 to S-1 do
        ReadLn(X_1[i], Y_1[i], X_2[i], Y_2[i]);

    ReadLn(N);

    for i:=0 to N-1 do
        ReadLn(x1[i], y1[i], x2[i], y2[i]);

    ans := 0;

    { INSERT YOUR CODE HERE }


    WriteLn(ans);

end.
