program erjipaixu;
const n=100000;
type
data=record
main:integer;
other:integer;
end;
procedure work;
var
vip,middle:array of data;
m,o,link:array[1..n] of integer;
p,q,i,j,a:integer;
begin
readln(a);
for i:=1 to a do with vip[i] do
begin
link[i]:=i;
write('main');
readln(main);
write('other');
readln(other);
m[i]:=main;
o[i]:=other;
end;
for i:=1 to a do
for j:= 1 to a do
begin
if m[i]>m[j] then
begin
p:=m[i];
m[i]:=m[j];
m[j]:=p;
q:=link[i];
link[i]:=link[j];
link[j]:=q;
end;
end;
for i:=1 to a do
for j:= 1 to a do
begin
if m[i]=m[j] then
begin
p:=m[i];
m[i]:=m[j];
m[j]:=p;
end;
end;
for i:=1 to a do
with vip[i] do
begin
for j:= 1 to a do
begin
if main=m[j] then
begin
middle:=vip[i];
vip[i]:=vip[j];
vip[j]:=middle;
end;
end;
end;
for i:= 1 to a do
with vip[i] do
begin
writeln(main,' ',other);
end;
end;
begin
work;
end.
求高人指点哪里错了........