程序:
var
n,i,j,x,z,w:longint;
a,b,c,d,p,y:array[0..200]of longint;
begin
assign(input,'sort.in');
reset(input);
assign(output,'sort.out');
rewrite(output);
readln(n);
for i:=1 to n do
begin
readln(x,y[i],z,d[i]);
a[d[i]]:=x;
b[d[i]]:=y[i];
c[d[i]]:=z;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if d[i]<d[j] then
begin
w:=d[i];d[i]:=d[j];d[j]:=w;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if y[i]<y[j] then
begin
w:=y[i];y[i]:=y[j];y[j]:=w;
end;
p[y[1]]:=1;
for i:=2 to n do
if y[i]<>y[i-1] then p[y[i]]:=i else p[y[i]]:=p[y[i-1]];
for i:=1 to n do
writeln(a[d[i]],' ',b[d[i]],' ',c[d[i]],' ',d[i],' ',i,' ',p[b[d[i]]]);
close(input);
close(output);
end.