var a,b,c:array[1..1000] of longint;
i,n,l,s,s2,n2,j:longint;
begin
  readln(n);
  for i:=1 to n do
  begin
    read(a[i]);
    s:=s+a[i];
  end;
  n2:=n div 2;
  s2:=s div n2;

  for i:=1 to n do
    begin
      for j:=1 to n do
        if (i<>j) and (a[i]+a[j]=s2) then begin
                               l:=l+1;
                               b[l]:=i;
                               c[l]:=j;
                               a[i]:=0;
                               a[j]:=0;
                               break;
                             end;
    end;

  for i:= 1 to l do
    writeln(b[i],' ',c[i]);
end.

var n,i,j,k:integer;
    a:array[1..105] of integer;

begin
 readln(n);
 for i:=1 to n do
  begin
   read(a[i]);k:=k+a[i];
  end;
 k:=k*2 div n;
 for i:=1 to n do
  begin
   for j:=i+1 to n do
    if a[i]+a[j]=k then begin writeln(i,' ',j);a[j]:=0; break; end;
  end;
end.

                                {***ABDUMALIK***}
var
  a,b:array [1..100] of integer;
  i,j,n,m,k:integer;
begin
  read(n);
  for i:=1 to n do
    read(a[i]);
  b:=a;
  for i:=1 to n do
    for j:=1 to n do
      if a[i]>a[j] then swap(a[i],a[j]);
  for j:=1 to round(n/2) do
    begin
    for  i:=1 to n do
    if (b[i]=a[j]) and (b[i]<>-5) then begin write(i,' '); b[i]:=-5; break; end;
    for  i:=1 to n do
    if (b[i]=a[n-j+1]) and (b[i]<>-5) then begin writeln(i); b[i]:=-5; break; end;
    end;
end.

var n,i,c,j,b,d,f : integer;
	a : array[1..100] of integer;
	g : array[1..100] of boolean;
begin
	readln(n);
	c := 0;
	 b:= 0;
	 f := 0;
	 fillchar(g,sizeof(g),true);
	for i := 1 to n do
	begin
		read(a[i]);
		c := c+a[i];
	end;
	d := c div (n div 2);

	for i := 1 to n    do
	begin

		if  g[i] then
		begin
			for j := 2 to n do
			begin

				if (i<> j) and (a[i]+a[j] = d) and g[j] then
				begin

					g[i] := false;
					g[j] := false;
					break;
				end;
			end;
			write(i,' ',j);
		writeln;
		end;

	end;
end.

var j,i,n,s,k:longint; arr:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(arr[i]);
s:=s+arr[i];
end;
k:=(s div (n div 2));
for i:=1 to n do
 begin
 if arr[i]=0 then continue;
 for j:=i+1 to n do
  begin
  if (i=j) or (arr[j]=0) then continue
  else if (arr[i]+arr[j]=k) then begin arr[i]:=0; arr[j]:=0; writeln(i,' ',j);  end;
  end;
 end;
end.

var
        a,pos : array[1..100] of longint;
        i,n : longint;

procedure swap(var x,y : longint);
        var
                tmp : longint;
        begin
                tmp := x;
                x := y;
                y := tmp;
        end;

procedure qsort(l,r : longint);
        var
                i,j,k : longint;
        begin
                i := l;
                j := r;
                k := a[l+random(r-l+1)];
                while i < j do begin
                        while a[i] < k do inc(i);
                        while a[j] > k do dec(j);
                        if i <= j then begin
                             swap(a[i],a[j]);
                             swap(pos[i],pos[j]);
                             inc(i);
                             dec(j);
                        end;
                end;
                if l < j then qsort(l,j);
                if i < r then qsort(i,r);
        end;

begin
        readln(n);
        for i := 1 to n do begin
                read(a[i]);
                pos[i] := i;
        end;
        qsort(1,n);
        for i := 1 to n div 2 do
                writeln(pos[i],' ',pos[n-i+1]);
end.

program p1;
var a:array[1..100] of integer;
    i,j,sum,n:integer;
begin
   readln(n);
   for i:=1 to n do read(a[i]);
   for i:=1 to n do sum:=sum+a[i];
   sum:=sum div (n div 2);
   for i:=1 to n-1 do begin
     j:=i+1;
     if a[i]<>0 then begin
         while (a[j]+a[i])<>sum do inc(j);
         writeln(i,' ',j);
         a[j]:=0;
      end;
      end;
end.

program brbrbrbbr;
var
  A,PR,NUM:array[1..100] of longint;
  n,sum,i,j,pr1:longint;
begin
  {Assign(input,'input.txt');
  Reset(input);
  Assign(output,'output.txt');
  Rewrite(output);}

  readln(n); sum:=0;
  for i:=1 to n do begin read(a[i]); num[i]:=i; inc(sum,a[i]); end;

  sum:=sum div (n div 2);
  for i:=1 to n do if pr[i]=0 then begin
   j:=1; pr1:=0;
   while (j<=n)and(pr1=0) do begin
    if (pr[j]=0)and(a[i]+a[j]=sum)and(i<>j) then begin pr[j]:=1; writeln(i,' ',j); pr1:=1; end;
    inc(j);
   end;
   pr[i]:=1;
  end;

//Close(input); Close(output);
end.

var n, i, j, x, y:integer;
    a, b:array [1..10000] of longint;
begin
 read(n);
 for i:=1 to n do begin
  read(a[i]);
  b[i]:=i;
 end;
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if a[i]>a[j] then begin
    x:=a[i]; a[i]:=a[j]; a[j]:=x;
    y:=b[i]; b[i]:=b[j]; b[j]:=y;
   end;
 for i:=1 to n div 2 do
  writeln(b[i],' ',b[n-i+1]);
end.

var
a:array[1..101] of longint;
n,i,j,b,n1:longint;

begin
 readln(n);
 for i:=1 to n do
 begin
  read(a[i]);
  b:=b+a[i];
 end;
 n1:=n div 2;
 b:=b div n1;
 for i:=1 to n do
  begin
    if a[i]<>0 then begin
                     for j:=i+1 to n do
                      begin
                       if a[i]+a[j]=b then begin
                                            writeln(i,' ',j);
                                            a[i]:=0;
                                            a[j]:=0;
                                           end;
                      end;
                    end;
  end;
end.

uses math;
const fi='';
      fo='';
      maxn=101;

var f1,f2:text;
    a,vt:array[0..maxn]of longint;
    n:longint;
procedure openfile;
 begin
  assign(f1,fi);
  reset(f1);
  assign(f2,fo);
  rewrite(f2);
 end;
procedure closefile;
 begin
  close(f1);
  close(f2);
 end;
procedure input;
 var i:longint;
 begin
  readln(f1,n);
  for i:=1 to n do read(f1,a[i]);
 end;

procedure init;
  var i,j,tg:longint;
  begin
   for i:=1 to n do
    vt[i]:=i;
   for i:=1 to n do
    for j:=2 to n do
     if a[j]<a[j-1] then
     begin
      tg:=a[j];a[j]:=a[j-1];a[j-1]:=tg;
      tg:=vt[j];vt[j]:=vt[j-1];vt[j-1]:=tg;
     end;
  end;

procedure solve;
  var i:longint;
  begin
   for i:=1 to n div 2 do
    begin
     writeln(f2,vt[i],' ',vt[n+1-i]);
    end;
  end;

procedure output;

  begin

  end;

begin
 openfile;
 input;
 init;
 solve;
 output;
 closefile;
end.

        {$mode objfpc}
        {$coperators on}
uses math;
const
        {$ifdef online_judge}  fi=''; fo='';
        {$else} fi='inp.inp';
                fo='out.out';
        {$endif}
var
        n, sl : longint;
        a : array[1..100] of longint;
        f : array[1..100] of boolean;
        r : array[1..100] of record x,y:integer; end;
        s : longint;
procedure enter;
var i, j : integer;
        begin
                        readln(n);
                        for i:=1 to n do
                                begin
                                        read(a[i]);
                                        s+=a[i];
                                end;
        end;
procedure solve;
var i, j, d: integer;
        begin
                s:=s div (n div 2);
                d:=0;
                repeat
                        d+=2;
                        i:=1;
                        while (i<=n)and(f[i]) do i+=1;
                        f[i]:=true;
                        j:=i+1;
                        while ((j<=n)and(f[j]))or(a[j]+a[i]<>s)do j+=1;
                        f[j]:=true;
                        sl+=1;
                        r[sl].x:=i; r[sl].y:=j;
                until d=n;
                for i:=1 to sl do writeln(r[i].x, ' ', r[i].y);
        end;
begin

        assign(input, fi); assign(output, fo); reset(input);  rewrite(output);
        enter;
        solve;
end.

var a, b :array [1..100] of longint;
    k, i, j, n : longint;
begin
    readln(n);
    for i := 1 to n do
        read(a[i]);
    for i := 1 to n do
        b[i] := i;
    for i := 1 to n do
        for j := 1 to n - 1 do
            if a[j] > a[j + 1] then begin
                k := a[j];
                a[j] := a[j + 1];
                a[j + 1] := k;
                k := b[j];
                b[j] := b[j +1];
                b[j + 1] := k;
            end;
    for i := 1 to n div 2 do
        writeln( b[i], ' ', b[n - i + 1]);
end.

//i am so sorry but i have to do thissssssssssssssssssssssss
const
   fin='701A.inp';fon='701A.out';
var i,j,n,g,s,t:longint;
   a:array[1..100] of longint;
   kt:array[1..100] of longint;
procedure mo;
begin
assign(input,fin);reset(input);
assign(output,fon);rewrite(output);
end;

//plz godddddddd helppppp meeeeeeeee you are the shadow to my life can u feel oooooooooooooooooooooooooo
procedure solve;
begin
readln(n);
s:=0;
for i:=1 to n do
   begin
   read(a[i]);
   kt[i]:=0;
   s:=s+a[i];
   end;
t:=s div (n div 2);
for i:=1 to n-1 do
   begin
   if kt[i]=0 then
      begin
      kt[i]:=1;
      g:=t-a[i];
      for j:=i+1 to n do
         begin
         if (i<>j) and (kt[j]=0) then
            if a[j]=g then
               begin
               kt[j]:=1;
               writeln(i,' ',j);
               break;
               end;
         end;
      end;
   end;
end;

//ho lee schitt
begin
//mo;
solve;
end.
//damn it i failed, plz dont skip me :((

var n,i,sum,j:integer;
a:array[1..100] of integer;
f:array[1..100] of boolean;

begin
read(n);
sum:=0;
for i:=1 to n do
begin
read(a[i]);
sum:=sum+a[i];
end;
sum:=sum div (n div 2);
for i:=1 to n do
 begin
 if f[i]=false then
   begin
   j:=i+1;
   while not ((a[j]+a[i]=sum) and (f[j]=false)) do
   inc(j);
   writeln(i,' ',j);
   f[i]:=true;
   f[j]:=true;
   end;
 end;
end.

var a,b:array [1..1111] of longint; n,i,j,s:longint;
begin
  readln (n);
  for i:=1 to n do read (a[i]);
  s:=0;
  for i:=1 to n do s:=s+a[i];
  s:=s div (n div 2);
  i:=1;
  while i<=n do
   begin
     if b[i]=0 then
       begin
         b[i]:=1;
         j:=i+1;
         while (a[i]+a[j]<>s) or (b[j]=1) do j:=j+1;
         writeln (i,' ',j);
         b[j]:=1;
       end;
     i:=i+1;
   end;

end.

program z;
type card=record
         ind,num:byte;
         end;

var n:byte;
       a:array[1..100] of card;
       tmp:card;
       i,j:byte;
begin
    read(n);
    for i:=1 to n do
      begin
            read(a[i].num);
            a[i].ind:=i;
      end;

    for i:=1 to n do
    for j:=n downto i+1 do
        if a[j].num<a[j-1].num then
            begin
               tmp:=a[j];
               a[j]:=a[j-1];
               a[j-1]:=tmp;
             end;

     i:=1; j:=n;
     while i<j do
       begin
        writeln(a[i].ind,' ',a[j].ind);
        inc(i); dec(j);
       end;
 end.

program yan;
  var ar,an:array[1..100]of longint;
      i,j,x,y,a,b,n,m:longint;
begin
  readln(n);
  for i:=1 to n do
    begin
      read(ar[i]);
      an[i]:=i;
    end;
  for i:=1 to n-1 do
    for j:=1 to n-i do
      if ar[j]>ar[j+1] then
        begin
          x:=ar[j]; ar[j]:=ar[j+1]; ar[j+1]:=x;
          x:=an[j]; an[j]:=an[j+1]; an[j+1]:=x;
        end;
  for i:=1 to n div 2 do
    writeln(an[i],' ',an[n-i+1]);
end.

var s,n,i,j,d:longint;
    a,ch:array[1..10000] of longint;
begin
  read(n);
   for i:=1 to n do
     begin
     read(a[i]);
       s:=s+a[i];
     end;
   d:=s div (n div 2);
   for i:=1 to n-1 do
      if ch[i]=0 then
    for j:=i+1 to n do
      if ch[j]=0 then
        if a[j]+a[i]=d then
          begin
          ch[j]:=1;
          writeln(i,' ',j);
          break;
          end;

end.

program z1;
type inputar = array[1..100] of longint;
var a,b,c,d,i,j,k,l,m,n:longint; Z:inputar;

Procedure Go(x:longint; a:inputar);
var ans:array[1..100,1..2] of longint; i,j,uk:longint;
begin
uk:=0;
for i:=1 to n do
 for j:=i+1 to n do
 if (a[i]<>-1) and (a[j]<>-1) then
 if a[i]+a[j]=x then
 begin
 inc(uk);
 ans[uk,1]:=i; ans[uk,2]:=j;
 a[i]:=-1; a[j]:=-1;
 end;
if uk=n div 2 then
begin
for i:=1 to uk do writeln(ans[i,1],' ',ans[i,2]);
halt;
end;
end;

begin
//assign(input,'d:\input.txt'); reset(input);
//assign(output,'d:\output.txt'); rewrite(output);
readln(n);
for i:=1 to n do read(Z[i]);
for i:=2 to 200 do
Go(i,Z);
end.

program Aproblem;
var a,v:array[0..100] of integer;
    i,n,s,ii:integer;
begin
     readln(n); s:=0;
     for i:=1 to n do
     begin
          read(a[i]);
          s:=s+a[i];
     end;
     s:=trunc(2*s/n);
     fillchar(v,sizeof(v),0);
     for i:=1 to n do
     begin
          if v[i]=0 then
          begin
          for ii:=1 to n do
          begin
               if (i<>ii) and (a[i]+a[ii]=s) and (v[ii]=0) and (v[i]=0) then
               begin
               writeln(i,' ',ii);
               v[i]:=1;v[ii]:=1;
               end;
          end;
          end;
     end;
end.

var n: byte;
    cards, answers: array of byte;
    summ, avg: integer;

function InArray(N: byte; arr: array of byte): boolean;
begin
  for var i := 0 to arr.Length - 1 do
    if N = arr[i] then result := true;
end;

begin
  Readln(n);
  cards := new byte [n];
  answers := new byte [n];
  for var i := 0 to n - 1 do
    Read(cards[i]);
  for var i := 0 to n - 1 do
    summ += cards[i];
  avg := Round(summ / (n / 2));
  var counter: integer := 0;
  for var i := 0 to n - 1 do
    for var j := 0 to n - 1 do
    if (i <> j) and (cards[i] + cards[j] = avg) then
    begin
      if (not InArray(i + 1, answers)) and (not InArray(j + 1, answers)) then
      begin
        answers[counter] := i + 1;
        answers[counter + 1] := j + 1;
        counter += 2;
        break;
      end;
    end;

  for var i := 0 to n - 2 do
    if i mod 2 = 0 then
      Writeln(answers[i], ' ', answers[i + 1]);
end.

var
n,u,i,o:longint;
a:array[1..100]of longint;
begin
readln(n); u:=0;
for i:=1 to n do
begin read(a[i]);
inc(u,a[i]); end;
u:=u div (n div 2);
for i:=1 to n-1 do
for o:=i+1 to n do
if a[i]+a[o]=u then
begin a[o]:=-1000000;
a[i]:=a[o];
writeln(i,' ',o); end;
end.

Var a,b:array [1..100] of longint;
    i,n:longint;
procedure qSort(l,r:longint);
  var i,j,z,x:longint;
begin
   i:=l;
   j:=r;
   x:=a[(i+j)div 2];
   repeat
        while a[i]<x do i:=i+1;
        while a[j]>x do j:=j-1;
        if i<=j then begin
                        z:=a[i];
                        a[i]:=a[j];
                        a[j]:=z;
                        z:=b[i];
                        b[i]:=b[j];
                        b[j]:=z;
                        i:=i+1;
                        j:=j-1;
                      end;
   until (i>j);
   if i<r then qSort(i,r);
   if j>l then qSort(l,j);
end;
 Begin
  read(n);
  for i:=1 to n do
   read(a[i]);
  for i:=1 to n do
   b[i]:=i;
  qSort(1,n);
  for i:=1 to n div 2 do
   writeln(b[i],' ',b[n-i+1]);
 End.

{$MODE OBJFPC}

Program cf364a;

Const
  Input= '';
  Output= '';

Var
  Fi, fo: text;
  n, i: integer;
  a, id: array[1..100] of integer;

Procedure Enter;
  Begin
    readln(Fi, n);
    for i:=1 to n do
      begin
        read(fi, a[i]);
        id[i]:= i;
      end;
  End;

procedure QS(l, h: integer);
  var i, j, pivot, pivotid: integer;
  begin
    if l>= h then exit;
    i:= l+ random(h-l+1);
    pivot:= a[i]; pivotid:= id[i];
    a[i]:= a[l]; id[i]:= id[l];
    i:= l; j:= h;
    repeat
      while (i<j) and (pivot< a[j]) do dec(j);
      if i<j then
        begin
          a[i]:= a[j];
          id[i]:= id[j];
          inc(i);
        end
      else break;
      while (i<j) and ( a[i]<pivot) do inc(i);
      if i< j then
        begin
          a[j]:= a[i];
          id[j]:= id[i];
          dec(j);
        end
      else break;
    until i= j;
    a[i]:= pivot;
    id[i]:= pivotid;
    QS(l, i-1); QS(i+1, h);
  end;

Procedure Solve;
  Begin
    QS(1, n);
  End;

Procedure Finish;
  Begin
    for i:= 1 to n div 2 do writeln(Fo, id[i],' ', id[n-i+1]);
  End;

Begin
  Assign(Fi, Input); Reset(Fi);
  Assign(Fo, Output); Rewrite(Fo);
  Enter;
  SOlve;
  Finish;
  Close(Fi); Close(Fo);
End.

var
  n: integer;
  a: array[1..100] of integer;
  i, summ, k, s, j: integer;

begin
  readln(n);
  summ := 0;
  k := n div 2;
  for i := 1 to n do
  begin
    read(a[i]);
    summ := summ + a[i];
  end;

  s := summ div k;

  for i := 1 to n do
    for j := 1 to n do
      if (a[i] + a[j] = s) and (i<>j) then
      begin
        writeln(i, ' ', j);
        a[i] := 0;
        a[j] := 0;
      end;

end.

var n , i, j, sum, sum1 : longint;
    A : array [1..200] of longint;
begin
   readln(n);
   for i := 1 to n do
      read(A[i]);
   sum := 0;
   sum1 := 0;
   for i := 1 to n do
      sum := sum + A[i];
   sum := sum div (n div 2);
   for i := 1 to n do
      for j := 1 to n do
         if (A[i] + A[j] = sum) and (i <> j) then
         begin
            writeln(i,' ', j);
            A[i] := 200;
            A[j] := 200;
            break;
         end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;
type m=array [1..100,1..2] of longint;
procedure qsort1 (var v:m; n:longint);
procedure qSort(l,r:longint);
var i,j,w,q:longint;
begin
  i := l; j := r;
  q := v[(l+r) div 2,1];
  repeat
    while (v[i,1] < q) do inc(i);
    while (q < v[j,1]) do dec(j);
    if (i <= j) then
    begin
      w:=v[i,1]; v[i,1]:=v[j,1]; v[j,1]:=w;
      w:=v[i,2]; v[i,2]:=v[j,2]; v[j,2]:=w;
      inc(i); dec(j);
    end;
  until (i > j);
  if (l < j) then qSort(l,j);
  if (i < r) then qSort(i,r);
end;
begin
qsort(1,n);
end;
var
 mas:m;
 i,n,j:longint;
begin
 read(n);
 for i:=1 to n do
 begin
  read(mas[i,1]);
  mas[i,2]:=i;
 end;
 qsort1(mas,n);
// for i:=1 to n do
//  write(mas[i,1], ' ');
 j:=n;
 for i:=1 to (n div 2) do
 begin
 if mas[i,2]>mas[j,2] then
 writeln(mas[j,2],' ',mas[i,2]) else
  writeln(mas[i,2],' ',mas[j,2]);
  dec(j);
 end;
readln;
readln;
end.

program cards;
const input='';
      output='';
      maxn=100;
var a: array[1..maxn] of integer;
    id: array[1..maxn] of integer;
    n: integer;

procedure enter;
var fi: text;
    i: integer;
begin
   assign(fi,input);
   reset(fi);
   readln(fi,n);
   for i:=1 to n do
      begin
         read(fi,a[i]);
         id[i]:=i;
      end;
   close(fi);
end;

procedure QuickSort(L,R: integer);
var i, j, mid, phu: integer;
begin
   i:=L; j:=R; mid:=a[(L+R) div 2];
   repeat
      while a[i]<mid do inc(i);
      while a[j]>mid do dec(j);
      if i<=j then
         begin
            phu:=a[i];
            a[i]:=a[j];
            a[j]:=phu;
            phu:=id[i];
            id[i]:=id[j];
            id[j]:=phu;
            inc(i);
            dec(j);
         end;
   until i>j;
   if i<R then QuickSort(i,R);
   if L<j then QuickSort(L,j);
end;

procedure init;
begin
   QuickSort(1,n);
end;

procedure xuat;
var fo: text;
    i: integer;
begin
   assign(fo,output);
   rewrite(fo);
   for i:=1 to (n div 2) do writeln(fo,id[i],' ',id[n-i+1]);
   close(fo);
end;

BEGIN
   enter;
   init;
   xuat;
END.

const
   tfi='';
   tfo='';

type info= record
   val, pos: longint; end;

var
   fi, fo: text;
   n: longint;
   a: array[0..105] of info;

procedure __;
var
   i: longint;
begin
   assign(fi, tfi); reset(fi);
   assign(fo, tfo); rewrite(fo);
   readln(fi, n);
   for i:=1 to n do read(fi, a[i].val);
   for i:=1 to n do a[i].pos := i;
end;

procedure sort(l, r: longint);
var
   i, j, mid: longint;
   tmp: info;
begin
   i:=l;j:=r;
   mid := a[(l+r) div 2].val;
   repeat
      while a[i].val<mid do inc(i);
      while a[j].val>mid do dec(j);
      if i<=j then
         begin
            tmp := a[i]; a[i] := a[j]; a[j] := tmp;
            inc(i); dec(j);
         end;
   until i>j;
   if i<r then sort(i, r);
   if l<j then sort(l, j);
end;

procedure xuly;
var
   i: longint;
begin
   for i:=1 to (n div 2) do
      writeln(fo, a[i].pos,' ', a[n-i+1].pos);
end;

procedure _;
begin
   close(fi); close(fo);
end;

BEGIN
   __;
   sort(1, n);
   xuly;
   _;
END.

var i,l,r,n:longint;
    a,cs:array[0..101] of longint;
procedure sort(l,r:longint);
var i,j,x,c:longint;
begin
    i :=l;j :=r;x :=a[l+random(r-l+1)];
    While i<j do
    begin
        While (a[i] < x) do inc(i);
        While (a[j] > x) do dec(j);
        If (i<=j) then
        begin
            c :=a[i];a[i] :=a[j];a[j] :=c;
            c :=cs[i];cs[i] :=cs[j];cs[j] :=c;
            inc(i);dec(j);
        end;
    end;
    If (l<j) then sort(l,j);
    If (i<r) then sort(i,r);
end;
begin
    readln(n);
    For i:=1 to n do
    begin
        read(a[i]);cs[i] :=i;
    end;
    sort(1,n);l :=1;r :=n;
    While l<r do
    begin
        writeln(cs[l],' ',cs[r]);
        inc(l);dec(r);
    end;
end.

var
	n,i,j,sum			:longint;
	a					:array[0..1005] of longint;
	v					:array[0..1005] of boolean;
begin
	read(n);
	for i:=1 to n do
	begin
		read(a[i]);
		inc(sum,a[i]);
	end;
	sum:=sum div (n div 2);
	for i:=1 to n do
	begin
		if not v[i] then
		begin
			v[i]:=true;
			for j:=i+1 to n do
			begin
				if v[j] then continue;
				if a[i]+a[j]=sum then
				begin
					writeln(i,' ',j);
					v[j]:=true;
					break;
				end;
			end;
		end;
	end;
end.

Var a:array[1..100] of longint;sum,i,j,n,u:longint;used:array[1..100] of boolean;
Begin
        readln(n);
        for i:=1 to n do
        begin
        read(a[i]);
        sum:=sum+a[i];
        end;
        u:=sum div (n div 2);
        for i:=1 to n do
        begin
        if used[i]<>true then
        for j:=i+1 to n do
        if (used[j]<>true) and (u-a[i]=a[j]) then
        begin
        writeln(i,' ',j);
        used[i]:=true;
        used[j]:=true;
        break;
        end;
        end;
End.

var
n,i,j,x:longint;
a,ind:array[1..10000]of integer;
begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to n do ind[i]:=i;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then begin
    x:=a[i];
    a[i]:=a[j];
    a[j]:=x;
    x:=ind[i];
    ind[i]:=ind[j];
    ind[j]:=x;
end;
for i:=1 to n div 2 do
writeln(ind[i],' ',ind[n-i+1]);
end.

var i,t,n,j:integer;
a:array [1..100] of integer;
free:array [1..100] of boolean;
begin
        readln(n);
        t:=0;
        for i:=1 to n do
        begin
                read(a[i]);
                t:=t+a[i];
        end;
        t:=t div (n div 2);
        fillchar(free,sizeof(free),true);
        for i:=1 to n do
        if free[i] then
                for j:=i+1 to n do
                if (free[j]) and (a[i]+a[j]=t) then
                begin
                        free[i]:=false;
                        free[j]:=false;
                        writeln(i,' ',j);
                        break;
                end;
end.

var a:array[1..1000, 1..2]of int64;
    n, i, j, buf:longint;
begin
    readln(n);
    for i:=1 to n do read(a[i, 1]);
    for i:=1 to n do a[i, 2]:=i;
    for i:=1 to n-1 do
      for j:=i+1 to n do if a[i, 1]>a[j, 1] then begin buf:=a[i, 1]; a[i, 1]:=a[j, 1]; a[j, 1]:=buf; buf:=a[i, 2]; a[i, 2]:=a[j, 2]; a[j, 2]:=buf; end;
    for i:=1 to n div 2 do writeln(a[i,2], ' ', a[n-i+1, 2]);
end.

var
 a,b,c,d,n,m,p,i,i2,i4:integer;
 q:array[1..100] of integer;
 w:array[1..100] of integer;
 s:string;
Begin
 readln(p);
 m:=999;
 n:=0;
 for i:=1 to p do begin
 read(q[i]);
 if n<q[i] then n:=q[i];
 if m>q[i] then m:=q[i];
 end;

 for i:=1 to p do
 for i2:=1 to p do
  if ((n+m)-(q[i]+q[i2])=0) and (i<>i2) and (q[i]<>0) and (q[i2]<>0) then begin
   writeln(i,' ',i2);
   q[i]:=0;
   q[i2]:=0;
  end;
end.

 var a:array [1..2,1..100] of byte;
     n,i,j,k:byte;

 begin
 readln(n);
 for i:=1 to n do
  begin
   read(a[1,i]);
   a[2,i]:=i;
  end;
 for i:=1 to n-1 do
  for j:=i+1 to n do
   if a[1,i]>a[1,j] then
                     begin
                      k:=a[1,i]; a[1,i]:=a[1,j]; a[1,j]:=k; //swap(a[1,i],a[1,j]);
                      k:=a[2,i]; a[2,i]:=a[2,j]; a[2,j]:=k;//swap(a[2,i],a[2,j]);
                     end;
 for i:=1 to n div 2 do writeln(a[2,i],' ',a[2,n-i+1]);
 end.

var
   kt:array [0..1000] of boolean;
   a:array [0..1000] of longint;
   i,j,n,s:longint;
begin
readln(n);
for i:=1 to n do
   begin
   read(a[i]);
   s:=s+a[i];
   end;
s:=s*2 div n;
for i:=1 to n do
   if kt[i]=false then
      begin
      kt[i]:=true;
      write(i,' ');
      for j:=i+1 to n do
      if kt[j]=false then
         if s-a[j]=a[i] then
            begin
            writeln(j);
            kt[j]:=true;
            break;
            end;
      end;
end.

const
  fi='';
var
  a,p:array[0..101] of longint;
  f:text;
  t,i,j,n:longint;
begin
  assign(f,fi); reset(f);
  readln(F,n); for i:=1 to n do read(f,a[i]);
  for i:=1 to n do p[i]:=i;
  close(f);
  for i:=1 to n-1 do
    for j:=n downto i do
      if a[i]>a[j] then
        begin
          t:=a[i]; a[i]:=a[j]; a[j]:=t;
          t:=p[i]; p[i]:=p[j]; p[j]:=t;
        end;
  for i:=1 to n div 2 do writeln(p[i],' ',p[n-i+1]);
  readln;
end.

var n,i,tong,tam,j:longint;
                a:array[1..100]of integer;
                dd:array[1..100]of byte;
begin
        readln(n);
        for i:=1 to n do
        begin
        read(a[i]);
        tong:=tong+a[i];
        end;
        tam:=tong div (n div 2);
        for i:=1 to n-1 do
        for j:=i+1 to n do
        if (a[i] + a[j] = tam) and (dd[i] = 0) and (dd[j] = 0) then
        begin
        writeln(i,' ',j);
        dd[i]:=1;
        dd[j]:=1;
        break;
        end;
        readln;
end.

program O_O;
 var
  i,j,k,n:longint;
  a,b:array[1..100] of longint;
  f:array[0..101] of longint;
procedure init;
 var
  i:longint;
begin
  readln(n);
  for i:=1 to n do
   begin
    read(a[i]);
    b[i]:=i;
   end;
end;
procedure sort;
 var
  i,j,t:longint;
begin
  for i:=1 to n-1 do
   for j:=i+1 to n do
    if a[i]>a[j] then
     begin
      t:=a[i];a[i]:=a[j];a[j]:=t;
      t:=b[i];b[i]:=b[j];b[j]:=t;
     end;
end;
procedure print;
 var
  i:longint;
begin
 for i:=1 to n div 2 do
  writeln(b[i],' ',b[n-i+1]);
end;
begin
  init;
  sort;
  print;
end.

var
	n, sum: integer;
	a: array of integer;

begin
	readln(n);
	SetLength(a, n);

	for var i := 0 to n - 1 do
	begin
		read(a[i]);
		sum += a[i];
	end;
	sum := sum div (n div 2);

	for var i := 0 to n - 1 do
		for var j := n - 1 downto 0 do
		begin
			if (a[i] + a[j] = sum) then
			begin
				write(j + 1);
				write(' ');
				writeln(i + 1);
				a[i] := 0;
				a[j] := 0;
				break;
			end;
		end;

end.

var kt:array[0..300]of boolean;
a:array[0..300]of longint;
i,n,m,j,k,s:longint;
begin
readln(n);
m:=n div 2;
for i:=1 to n do
    begin
    read(a[i]);
    s:=s+a[i];
    end;
for i:=1 to n do
    kt[i]:=true;
s:=s div m;
for i:=1 to m do
    begin
    k:=s;
    for j:=1 to n do
        if kt[j]=true then
            begin
            k:=k-a[j];
            write(j,' ');
            kt[j]:=false;
            break;
            end;
    for j:=1 to n do
        if (k-a[j]=0)and(kt[j]=true) then
            begin
            kt[j]:=false;
            writeln(j);
            break;
            end;
    end;
end.

program mirovanie;
var n,i,s,i2:integer; q:array[1..101] of integer;
begin
 readln(n);
 for i:=1 to n do begin read(q[i]); s:=s+q[i]; end;
 s:=s*2 div n;
 for i:=1 to n do
  begin
   if q[i]<>0 then
    for i2:=i+1 to n do
     begin
      if q[i]+q[i2]=s then begin writeln(i,' ',i2); q[i2]:=0; break; end;
     end;
  end;
end.

var
a:array[1..10000]of longint;
n,sum:longint;
c,i,j:longint;
bol:boolean;
begin
readln(N);
for i:=1 to n do begin
read(a[i]);
sum:=sum+a[i];
end;
for i:=1 to n div 2 do begin
bol:=false;
    for j:=1 to n do begin
    for c:=1 to n do
        if (a[j]+a[c]=(sum div (n div 2)))and(j<>c) then begin
            writeln(j,' ',c);
            a[c]:=-10;
            a[j]:=-10;
            bol:=true;
            break;
        end;
        if bol then break;
    end;
end;
end.

var mai,mi,min,max,n,i,o,k:integer;
a:array [1..100]of integer;
begin
read(n);
min:=101;
for i:=1 to n do
read(a[i]);
 while o<n div 2 do
 begin
 inc(o);
 for i:=1 to n do
 begin
 if (a[i]>=max)and(a[i]>0)then begin max:=a[i];mai:=i end ;
 if (a[i]<min)and(a[i]>0)then begin min:=a[i];mi:=i;end;
 end;
 a[mai]:=-1;
 a[mi]:=-1;
 max:=0;
 min:=101;
 writeln(mi,' ',mai);
 end;
 end.

var
    n,sum,equal,i,j,d : integer;
    a,t,res : array[1..100] of integer;
    kt : array[1..100] of boolean;
BEGIN
    readln(n);
    sum:= 0;
    for i:=1 to n do
        begin
            read(a[i]);
            sum:= sum+a[i];
        end;
    equal:= sum div (n div 2);
    fillchar(kt,sizeof(kt),true);
    d:= 1;
    kt[1]:= false;
    res[1]:= 1;
    t[1]:= a[1];
    for i:=1 to n do
    for j:=1 to n do
        if (kt[j]) and (t[i] <> equal) then
            if t[i] + a[j] = equal then
                begin
                    writeln(res[i],' ',j);
                    t[i]:= t[i]+a[j];
                    kt[j]:= false;
                end
        else if t[i] = 0 then
            begin
                t[i]:= a[j];
                inc(d);
                res[d]:= j;
                kt[j]:= false;
            end;
END.

var
  n, k, q, p, i, z, x: integer;
  mas, mas2: array [1..100] of integer;

begin
  readln(n);
  q := n + 1;
  for i := 1 to n do
    read(mas[i]);

  for i := 1 to n do
  begin
    x := x + 1;
    mas2[i] := x;
  end;

  repeat
    k := 1;
    for i := 1 to n - 1 do
      if mas[i] < mas[i + 1] then
      begin
        p := mas[i];
        mas[i] := mas[i + 1];
        mas[i + 1] := p;
        p := mas2[i];
        mas2[i] := mas2[i + 1];
        mas2[i + 1] := p;
        k := 0;
      end;
  until k = 1;

  for i := 1 to n div 2 do
  begin
    z := z + 1;
    q := q - 1;
    writeln(mas2[z], ' ', mas2[q]);
  end;

end.

var i,j,n:longint;
    a,b:array[0..1100000] of longint;

procedure sort(l,r:longint);
    var
        i,j,x,y:longint;
    begin
        i:=l;
        j:=r;
        x:=a[l+random(r-l+1)];
        repeat
            while (a[i]<x) do
                inc(i);
            while (a[j]>x) do
                dec(j);
            if not(i>j) then
            begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                y:=b[i];
                b[i]:=b[j];
                b[j]:=y;
                inc(i);
                dec(j);
            end;
        until i>j;
        if l<j then
            sort(l,j);
        if (i<r) then
            sort(i,r);
    end;
begin
    readln(n);
    for i:=1 to n do
    begin
        read(a[i]);
        b[i]:=i;
    end;
    sort(1,n);
    i:=1;
    j:=n;
    while (i<j) do
    begin
        writeln(b[i],' ',b[j]);
        inc(i);
        dec(J);
    end;
end.

const
   fin='701A.inp';fon='701B.out';
var i,j,n,g,s,t:longint;
   a:array[1..100] of longint;
   kt:array[1..100] of longint;
procedure mo;
begin
assign(input,fin);reset(input);
assign(output,fon);rewrite(output);
end;

procedure solve;
begin
readln(n);
s:=0;
for i:=1 to n do
   begin
   read(a[i]);
   kt[i]:=0;
   s:=s+a[i];
   end;
t:=s div (n div 2);
for i:=1 to n-1 do
   begin
   if kt[i]=0 then
      begin
      kt[i]:=1;
      g:=t-a[i];
      for j:=i+1 to n do
         begin
         if (i<>j) and (kt[j]=0) then
            if a[j]=g then
               begin
               kt[j]:=1;
               writeln(i,' ',j);
               break;
               end;
         end;
      end;
   end;
end;

begin
//mo;
solve;
end.

var
b:array[1..200]of boolean;
a:array[1..200]of longint;
n,i,j,f,sum:longint;
begin
  fillchar(b,sizeof(b),true);
  read(n);
  for I:=1 to n do
  begin
    read(a[i]);
    sum:=a[i]+sum;
  end;
  sum:=sum*2 div n;
  f:=0;
  for i:=1 to n do
  begin
    if b[i]=true
    then begin
           for j:=i+1 to n do
            if b[j]=true
            then if a[j]+a[i]=sum
                 then begin
                        f:=f+2;
                        b[i]:=false;
                        b[j]:=false;
                        writeln(i,' ',j);
                        break;
                      end;
         end;
    if f=n
    then exit;
  end;
end.

var a,c:array[1..100]of byte;n,i:byte;
procedure sort(l,r:byte);
var i,j,x,y:byte;
begin
        i:=l;j:=r;x:=a[(l+r) div 2];repeat while a[i]<x do inc(i);while x<a[j] do
        dec(j);if not(i>j) then
        begin
                y:=a[i];a[i]:=a[j];a[j]:=y;y:=c[i];c[i]:=c[j];c[j]:=y;inc(i);j:=j-1;
        end;until i>j;if l<j then sort(l,j);if i<r then sort(i,r);
end;begin
        readln(n);for i:=1 to n do read(a[i]);for i:=1 to n do c[i]:=i;sort(1,n);
        for i:=1 to n div 2 do writeln(c[i],' ',c[n-i+1]);readln;
end.

var a:array[1..100]of longint;
f:array[1..100]of boolean;
i,n,j,s:longint;
begin
readln(n);
for i:=1 to n do
read(a[i]);
s:=0;
for i:=1 to n do
s:=s+a[i];
fillchar(f,sizeof(f),true);
for i:=1 to n do
if f[i] then
begin
  f[i]:=false;
  write(i,' ');
  for j:=1 to n do
  if (i<>j)and(a[j]+a[i]=s div (n div 2))and(f[j]=true) then
  begin
    f[j]:=false;writeln(j);break;
  end;
end;
end.

program zzz;
var n,i,j,sum:integer;
    a:array[1..100]of integer;
begin
  readln(n);
  sum:=0;
  for i:=1 to n do
  begin
    read(a[i]);
    sum:=sum+a[i];
  end;
  sum:=(sum*2) div n;
  for i:=1 to n-1 do
    for j:=i+1 to n do
      if a[i]+a[j]=sum
      then begin
             writeln(i,' ',j);
             a[i]:=0;
             a[j]:=0;
           end;

end.

var
  a: array [1..100] of integer;
  i, k, l, j: integer;

begin
  read(k);

  for i := 1 to k do begin read(a[i]);l := l + a[i]; end;

  for i := 1 to k  do
    if a[i] = 0 then continue else
      for j := i+1 to k do
        if a[i] = (l div (k div 2)) - a[j] then begin
          a[i] := 0;
          a[j] := 0;
          writeln(i, ' ', j);
        end;

end.

const
        fin='';fon='';
var
        n,s:longint;
        a:array [1..100000] of longint;
procedure nhap;
        var
                i:longint;
        begin
        assign(input,fin);reset(input);
        assign(output,fon);rewrite(output);
        readln(n);
        for i:=1 to n do
                begin
                read(a[i]);
                inc(s,a[i]);
                end;
        s:=s div (N div 2);
        end;
procedure xuat;
        var
                i,j:longint;
        begin
        for i:=1 to n-1 do
                begin
                for j:=i+1 to n do
                        begin
                        if a[i]+a[j]=s then
                                begin
                                writeln(i,' ',j);
                                a[j]:=0;
                                break;
                                end;
                        end;
                end;
        close(input); close(output);
        end;
begin
nhap;
xuat;
end.

var
a:array[1..101] of longint;
used:array[1..101] of boolean;
i,n,s,each,j,k,p:longint;
begin
readln(n);
s:=0;
for i:=1 to n do
begin
read(a[i]);
s:=s+a[i];
end;
each:=(s*2) div n;
for i:=1 to n do
used[i]:=false;

for i:=1 to (n div 2) do
begin
        for j:=1 to n do
        if not used[j] then
                begin
                write(j,' ');
                used[j]:=true;
                p:=a[j];
                break;
                end;

        for k:=j+1 to n do
        if (not used[k])  and (a[k]=each-p) then
                begin
                writeln(k);
                used[k]:=true;
                break;
                end;

end;

end.

const
  inp = 'input.txt';
  out = 'output.txt';
  maxn = 100;

var
  n, sum : longint;
  a, id : array[0..maxn] of longint;
  free : array[0..maxn] of boolean;

procedure init;
  var i : Longint;
  begin
    sum := 0;
    readln(n);
    for i := 1 to n do
      begin
        read(a[i]);
        id[i] := i;
        sum := sum + a[i];
      end;
    sum := sum div (n div 2);
  end;

procedure solve;
  var i, j : longint;
  begin
    fillchar(free, sizeof(free), true);
    for i := 1 to n - 1 do
      if free[i] then
      begin
        for j := i + 1 to n do
          if free[j] then
            if a[i] + a[j] = sum then
              begin
                writeln(i,' ', j);
                free[j] := false;
                break;
              end;
      end;
  end;

begin
  //assign(input, inp); reset(input);
  //assign(output, out); rewrite(output);
  init;
  solve;
end.

var i,j,n,k,k1,q:longint;
    a:array[1..100,1..2] of longint;
BEGIN
readln(n);
for i:=1 to n do
 a[i,2]:=i;
for i:=1 to n do
 read(a[i,1]);

for i := 1 to n-1 do
 for j := 1 to n-i do
  if a[j,1] > a[j+1,1] then
   begin
    k:=a[j,1];
    k1:=a[j,2];
    a[j,1]:=a[j+1,1];
    a[j,2]:=a[j+1,2];
    a[j+1,1]:=k;
    a[j+1,2]:=k1;
   end;

  q:=n;
for i:=1 to n div 2 do
  begin
  writeln(a[i,2],' ',a[q,2]);
  dec(q);
  end;

END.

var a:array[1..100,0..1]of integer;
i,j,n,sw:integer;
begin
     readln(n);
     for i:=1 to n do
     begin
          read(a[i,1]);
          a[i,0]:=i;
     end;
     for j:=1 to n-1 do
         for i:=1 to n-1 do
         if a[i,1] < a[i+1,1] then
         begin
              sw:=a[i,1];
              a[i,1]:=a[i+1,1];
              a[i+1,1]:=sw;
              sw:=a[i,0];
              a[i,0]:=a[i+1,0];
              a[i+1,0]:=sw;
         end;
     i:=1;
     j:=n;
     while i <= j do
     begin
           writeln(a[i,0],' ',a[j,0]);
           i:=i+1;
           j:=j-1;
     end;
end.

begin
 var n:=readinteger();
 var a:=arr(0)*n;
 var s:=0;
 for var i:=0 to n-1 do
 begin
   read(a[i]);
   s+=a[i];
 end;
 if s div (n)=a[0] then
 begin
   for var i:=1 to n div 2 do
     writeln(i*2-1,' ',i*2);
   exit();
 end;
 var x:=s div (n div 2);
  for var i:=0 to n-1 do
  begin
    if a[i]=-1 then
      continue;
    var g:=x-a[i];
    for var j:=i to n-1 do
    begin
      if a[j]=-1 then
        continue;
      if (g=a[j])and(j<>i) then
      begin
        a[i]:=-1;
        a[j]:=-1;
        writeln(i+1,' ',j+1);
        break;
      end;
      end;
  end;
end.

begin
 var n:=readinteger();
 var a:=arr(0)*n;
 var s:=0;
 for var i:=0 to n-1 do
 begin
   read(a[i]);
   s+=a[i];
 end;
 if s div (n)=a[0] then
 begin
   for var i:=1 to n div 2 do
     writeln(i*2-1,' ',i*2);
   exit();
 end;
 var x:=s div (n div 2);
  for var i:=0 to n-1 do
  begin
    var g:=x-a[i];
    for var j:=i to n-1 do
      if (g=a[j])and(j<>i) then
      begin
        writeln(i+1,' ',j+1);
        break;
      end;
  end;
end.

var n,i,tong,tb,j:longint;
                a:array[1..100]of integer;
begin
        readln(n);
        for i:=1 to n do
        begin
        read(a[i]);
        tong:=tong+a[i];
        end;
        tb:=tong*2 div n;
        for i:=1 to n do
        begin
        for j:=i+1 to n do
        if a[i] + a[j] = tb then
        begin
        writeln(i,' ',j);
        break;
        end;
        end;
        readln;
end.

var
b:array[1..200]of boolean;
a:array[1..200]of longint;
n,i,j,f,sum:longint;
begin
  fillchar(b,sizeof(b),true);
  read(n);
  for I:=1 to n do
  begin
    read(a[i]);
    sum:=a[i]+sum;
  end;
  sum:=sum*2 div n;
  f:=0;
  for i:=1 to n do
  begin
    if b[i]=true
    then begin
           for j:=i+1 to n do
            if b[j]=true
            then if a[j]+a[i]=sum
                 then begin
                        f:=f+2;
                        b[i]:=false;
                        b[j]:=false;
                        writeln(i,' ',j);
                      end;
         end;
    if f=n
    then exit;
  end;
end.

Const Finp='';
      Fout='';
      maxN=100;
Var n,val:longint;
    a,dau:array[1..maxN] of longint;

Procedure Nhap;
Var f:Text;
    i:longint;
Begin
    assign(f,finp); reset(f);
    readln(f,n);
    for i:=1 to n do
        read(f,a[i]);
    close(f);
End;
Procedure FindVal;
Var i,j,sum:longint;
Begin
    sum:=0;
    for i:=1 to n do
        sum:=sum+a[i];
    val:=(sum div n)*2;
End;
Procedure Xuat;
Var f:Text;
    i,j,cnt,lc:longint;
Begin
    assign(f,fout); rewrite(f);
    fillchar(dau,sizeof(dau),0);
    cnt:=0; lc:=0;
    for i:=1 to n-1 do
        if dau[i]=0 then
        begin
            for j:=i+1 to n do
                if (a[i]+a[j]=val) and (dau[j]=0) then
                    begin
                        dau[j]:=1;
                        writeln(f,i,' ',j);
                        inc(cnt);
                        if cnt=n div 2 then
                            lc:=1;
                        break;
                    end;
            if lc=1 then
                break;
        end;
    close(f);
End;

Begin
    nhap;
    findval;
    xuat;
End.

program zzz;
var n,i,j,sum:integer;
    a:array[1..100]of integer;
begin
  readln(n);
  sum:=0;
  for i:=1 to n do
  begin
    read(a[i]);
    sum:=sum+a[i];
  end;
  sum:=(sum div n)*2;
  for i:=1 to n-1 do
    for j:=i+1 to n do
      if a[i]+a[j]=sum
      then begin
             writeln(i,' ',j);
             a[i]:=0;
             a[j]:=0;
           end;

end.

Var
    n, k: Integer;
    a: Array [1..100] of Integer;

Begin
    Read(n);
    For Var i := 1 to n do
       Read(a[i]);
    For Var i := 1 to n - 1 do
      For Var j := 1 to n - i do
        If a[j] > a[j + 1] then Begin
          k := a[j];
          a[j] := a[j + 1];
          a[j + 1] := k
        End;
    For Var i := 1 to n div 2 do
      Writeln(i, ' ', n - i + 1)
End.

//i am so sorry but i have to do thissssssssssssssssssssssss
const
   fin='701A.inp';fon='701A.out';
var i,j,n,g,s,t:longint;
   a:array[1..100] of longint;
   kt:array[1..100] of longint;
procedure mo;
begin
assign(input,fin);reset(input);
assign(output,fon);rewrite(output);
end;

//plz godddddddd helppppp meeeeeeeee you are the shadow to my life can u feel oooooooooooooooooooooooooo
procedure solve;
begin
readln(n);
s:=0;
for i:=3 to n do
   begin
   read(a[i]);
   kt[i]:=0;
   s:=s+a[i];
   end;
t:=s div (n div 2);
for i:=1 to n-1 do
   begin
   if kt[i]=0 then
      begin
      kt[i]:=1;
      g:=t-a[i];
      for j:=i+1 to n do
         begin
         if (i<>j) and (kt[j]=0) then
            if a[j]=g then
               begin
               kt[j]:=1;
               writeln(i,' ',j);
               break;
               end;
         end;
      end;
   end;
end;

//ho lee schitt
begin
//mo;
solve;
end.
//damn it i failed, plz dont skip me :((

Var a:array[1..100] of longint;sum,i,j,n,u:longint;used:array[1..100] of boolean;
Begin
        readln(n);
        for i:=1 to n do
        begin
        read(a[i]);
        sum:=sum+a[i];
        end;
        u:=(sum div n)*2;
        for i:=1 to n do
        begin
        if used[i]<>true then
        for j:=i+1 to n do
        if (used[j]<>true) and (u-a[i]=a[j]) then
        begin
        writeln(i,' ',j);
        used[i]:=true;
        used[j]:=true;
        end;
        end;
End.

Var a:array[1..100] of longint;sum,i,j,n,u:longint;used:array[1..100] of boolean;
Begin
        readln(n);
        for i:=1 to n do
        begin
        read(a[i]);
        sum:=sum+a[i];
        end;
        u:=(sum div n)*2;
        for i:=1 to n do
        begin
        if used[i]<>true then
        for j:=i+1 to n do
        if (used[j]<>true) and (u-a[i]=a[j]) then
        begin
        writeln(i,' ',j);
        used[i]:=true;
        used[j]:=true;
        break;
        end;
        end;
End.

var
 a,b,c,d,n,m,p,i,i2,i4:integer;
 q:array[1..100] of integer;
 w:array[1..100] of integer;
 s:string;
Begin
 readln(p);
 m:=999;
 n:=0;
 for i:=1 to p do begin
 read(q[i]);
 if n<q[i] then n:=q[i];
 if m>q[i] then m:=q[i];
 end;

 for i:=1 to n do
 for i2:=1 to n do
  if ((n+m)-(q[i]+q[i2])=0) and (i<>i2) and (q[i]<>0) and (q[i2]<>0) then begin
   writeln(i,' ',i2);
   q[i]:=0;
   q[i2]:=0;
  end;
end.

var
   kt:array [0..1000] of boolean;
   a:array [0..1000] of longint;
   i,j,n,s:longint;
begin
readln(n);
for i:=1 to n do
   begin
   read(a[i]);
   s:=s+a[i];
   end;
s:=s*2 div n;
for i:=1 to n do
   if kt[i]=false then
      begin
      kt[i]:=true;
      write(i,' ');
      for j:=i+1 to n do
         if s-a[j]=a[i] then
            begin
            writeln(j);
            kt[j]:=true;
            break;
            end;
      end;
end.

const
        fin='';fon='';
var
        n,s:longint;
        a:array [1..100000] of longint;
procedure nhap;
        var
                i:longint;
        begin
        assign(input,fin);reset(input);
        assign(output,fon);rewrite(output);
        readln(n);
        for i:=1 to n do
                begin
                read(a[i]);
                inc(s,a[i]);
                end;
        s:=s div (N div 2);
        end;
procedure xuat;
        var
                i,j:longint;
        begin
        for i:=1 to n-1 do
                begin
                for j:=i+1 to n do
                        begin
                        if a[i]+a[j]=s then
                                begin
                                writeln(i,' ',j);
                                a[j]:=0;
                                end;
                        end;
                end;
        close(input); close(output);
        end;
begin
nhap;
xuat;
end.

VAR
  n:longint;
  a,b:array[1..100] of longint;

Procedure Nhap;
  Var
    i:longint;
  Begin
    Read(n);
    For i:=1 to n do
      BEgin
        Read(a[i]);
        b[i]:=i;
      End;
  End;

Procedure Xuli;
  VAr
    i,j,x:longint;
  Begin
    For i:=1 to n-1 do
      For j:=i+1 to n do
        If a[i]<a[j] then
          Begin
            x:=a[i];
            a[i]:=a[j];
            a[j]:=x;
            x:=b[i];
            b[i]:=b[j];
            b[j]:=x;
          End;
    For i:=1 to n div 2 do Writeln(i,' ',n-i+1);
  End;

BEGIN
  Nhap;
  Xuli;
END.

var j,i,n,s,k:longint; arr:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(arr[i]);
s:=s+arr[i];
end;
k:=2*(s div n);
for i:=1 to n do
 begin
 if arr[i]=0 then continue;
 for j:=1 to n do
  begin
  if (i=j) or (arr[j]=0) then continue;
  if arr[i]+arr[j]=k then begin arr[i]:=0; arr[j]:=0; writeln(i,' ',j); end;
  end;
 end;
end.

var j,i,n,s,k:integer; arr:array[1..100] of integer;
begin
read(n);
for i:=1 to n do
begin
read(arr[i]);
s+=arr[i];
end;
k:=2*(s div n);
for i:=1 to n do
 begin
 if arr[i]=0 then continue;
 for j:=1 to n do
  begin
  if i=j then continue;
  if arr[i]+arr[j]=k then begin arr[i]:=0; arr[j]:=0; writeln(i,' ',j); end;
  end;
 end;
end.

var j,i,n,s,k:longint; arr:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(arr[i]);
s:=s+arr[i];
end;
k:=2*(s div n);
for i:=1 to n do
 begin
 if arr[i]=0 then continue;
 for j:=1 to n do
  begin
  if i=j then continue;
  if arr[i]+arr[j]=k then begin arr[i]:=0; arr[j]:=0; writeln(i,' ',j); end;
  end;
 end;
end.

var j,i,n,s,k:longint; arr:array[1..100] of integer;
begin
readln(n);
for i:=1 to n do
begin
read(arr[i]);
s+=arr[i];
end;
k:=2*(s div n);
for i:=1 to n do
 begin
 if arr[i]=0 then continue;
 for j:=1 to n do
  begin
  if i=j then continue;
  if arr[i]+arr[j]=k then begin arr[i]:=0; arr[j]:=0; writeln(i,' ',j); end;
  end;
 end;
end.

var a :array [1..100] of integer;
    use : array [1..100] of boolean;
    s, i, j, n : longint;
begin
    readln(n);
    for i := 1 to n do begin
        read(a[i]);
        s := s + a[i];
    end;
    s := (s div n) * 2;
    for i := 1 to n do
        if not use[i] then begin
            use[i] := true;
            for j := i + 1 to n do
                if a[j] = s - a[i] then begin
                    writeln(i, ' ', j);
                    use[j] := true;
                    break;
                end;
        end;
end.

Var i , n , j , tmp : Integer;
    A , B : Array [1..100] of Integer;

Begin
Readln(n); tmp := 0;
Fillchar(B , sizeof(B) , 0);
For i := 1 to n do
    Begin
    Read(A[i]);
    tmp := tmp + A[i];
    End;
tmp := tmp div n * 2;
For i := 1 to n do
    For j := 1 to n do
        If i <> j then
        If (B[i] = 0) and (B[j] = 0) then
        If A[i] + A[j] = tmp then
            Begin
            Writeln(i ,' ', j);
            B[i] := 1;
            B[j] := 1;
            End;
If n = 2 then Writeln('1 2');
End.

Var i , n , j , tmp : Integer;
    A , B : Array [1..100] of Integer;

Begin
Readln(n); tmp := 0;
Fillchar(B , sizeof(B) , 0);
For i := 1 to n do
    Begin
    Read(A[i]);
    tmp := tmp + A[i];
    End;
tmp := tmp div n * 2;
For i := 1 to n do
    For j := 1 to n do
        If i <> j then
        If (B[i] = 0) and (B[j] = 0) then
        If A[i] + A[j] = tmp then
            Begin
            Writeln(i ,' ', j);
            B[i] := 1;
            B[j] := 1;
            End;
End.

program cards;
var i,j,s,max:integer;
    a,num,sp:array[1..1000] of integer;
    v:array[1..1000] of boolean;
begin
     s:=0;fillchar(v,sizeof(v),false);
     for i:=1 to 5 do
     begin
          read(a[i]);
          s:=s+a[i];
          num[a[i]]:=num[a[i]]+1;
     end;
     for i:=1 to 5 do
     begin
          if (num[a[i]]=2) and (v[i]=false) then begin sp[i]:=a[i]*num[a[i]];for j:=1 to 5 do if a[j]=a[i] then v[j]:=true; end;
          if (num[a[i]]>=3) and (v[i]=false) then begin sp[i]:=a[i]*3;for j:=1 to 5 do if a[j]=a[i] then v[j]:=true;end;
     end;
     for i:=1 to 5 do
     if max<=sp[i] then max:=sp[i];
     writeln(s-max);
end.

program Aproblem;
var a,v:array[0..100] of integer;
    i,n,s,ii:integer;
begin
     readln(n); s:=0;
     for i:=1 to n do
     begin
          read(a[i]);
          s:=s+a[i];
     end;
     s:=trunc(2*s/n);
     fillchar(v,sizeof(v),0);
     for i:=1 to n do
     begin
          if v[i]=0 then
          begin
          for ii:=1 to n do
          begin
               if (i<>ii) and (a[i]+a[ii]=s) and (v[ii]=0) then
               begin
               writeln(i,' ',ii);
               v[i]:=1;v[ii]:=1;
               end;
          end;
          end;
     end;
end.

program cards;
var i,j,s,max:integer;
    a,num,sp:array[1..1000] of integer;
    vv:array[1..1000] of boolean;
begin
     s:=0;fillchar(vv,sizeof(vv),false);
     for i:=1 to 5 do
     begin
          read(a[i]);
          s:=s+a[i];
          num[a[i]]:=num[a[i]]+1;
     end;
     for i:=1 to 5 do
     begin
          if (num[a[i]]=2) and (vv[i]=false) then begin sp[i]:=a[i]*num[a[i]];for j:=1 to 5 do if a[j]=a[i] then vv[j]:=true; end;
          if (num[a[i]]>=3) and (vv[i]=false) then begin sp[i]:=a[i]*3;for j:=1 to 5 do if a[j]=a[i] then vv[j]:=true;end;
     end;
     for i:=1 to 5 do
     if max<=sp[i] then max:=sp[i];
     writeln(s-max);
end.