program lus;
const
serializedRes: array[boolean] of String = ('NIE','TAK');
var
n,j: longint;
t,i: integer;
w1,w2,h1,h2,mw1,mw2,mh1,mh2: longint;
res: boolean;
begin
readln(t);
for i := 1 to t do
begin
readln(n);
res := true;
mw1 := 0;
for j := 1 to n do
begin
read(w1,w2,h1,h2);
readln();
if res then
begin
if mw1 = 0 then
begin
mw1 := w1;
mw2 := w2;
mh1 := h1;
mh2 := h2;
end
else
begin
if (w1 <= mw1) and (w2 >= mw2) and (h1 <= mh1) and (h2 >= mh2) then
begin
mw1 := w1;
mw2 := w2;
mh1 := h1;
mh2 := h2;
end
else
if not ((mw1 <= w1) and (mw2 >= w2) and (mh1 <= h1) and (mh2 >= h2)) then
begin
res := false;
end
end
end
end;
writeln(serializedRes[res]);
end
end.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | program lus; const serializedRes: array[boolean] of String = ('NIE','TAK'); var n,j: longint; t,i: integer; w1,w2,h1,h2,mw1,mw2,mh1,mh2: longint; res: boolean; begin readln(t); for i := 1 to t do begin readln(n); res := true; mw1 := 0; for j := 1 to n do begin read(w1,w2,h1,h2); readln(); if res then begin if mw1 = 0 then begin mw1 := w1; mw2 := w2; mh1 := h1; mh2 := h2; end else begin if (w1 <= mw1) and (w2 >= mw2) and (h1 <= mh1) and (h2 >= mh2) then begin mw1 := w1; mw2 := w2; mh1 := h1; mh2 := h2; end else if not ((mw1 <= w1) and (mw2 >= w2) and (mh1 <= h1) and (mh2 >= h2)) then begin res := false; end end end end; writeln(serializedRes[res]); end end. |
English