uses crt;
const n=18;
type St=string[3];
function Schet(p,q:byte):St;
var sp,sq:string;
begin
str(p,sp);str(q,sq);
Schet:=sp+':'+sq;
end;
function Itog(s:St):byte;
begin
if s[1]>s[3] then Itog:=2
else if s[1]=s[3] then Itog:=1
else if s[1]<s[3] then Itog:=0;
end;
function Revers(a:St):St;
var i:integer;
    a1:St;
begin
a1:='';
for i:=length(a) downto 1 do
a1:=a1+a[i];
Revers:=a1;
end;

var a:array[1..n*(n-1)div 2]of St;
    b:array[1..18,1..18]of St;
    i,j,k,m,p,kv,kn,kp:byte;
    x,y:array[1..n*(n-1)]of byte;

begin
clrscr;
randomize;
for i:=1 to n*(n-1)div 2 do
   begin
    x[i]:=random(6);
    y[i]:=random(6);
    a[i]:=Schet(x[i],y[i]);
   end;
for j:=1 to n do
for k:=j+1 to n do
  begin
    m:=k+(n-j-1)*(j-1);
    b[j,k]:=a[m];
  end;
for j:=1 to n do
for k:=1 to j-1 do
b[j,k]:=Revers(b[k,j]);
writeln('Turnirnaya tablica':45);
for j:=1 to n do
  begin
    for k:=1 to n do
    if k=j then
      begin
       Textcolor(0);
       write(chr(91),chr(64),chr(93),' ');
      end
    else if Itog(b[j,k])=0 then
      begin
       Textcolor(0);
       write(b[j,k],' ');
      end
    else if Itog(b[j,k])=1 then
      begin
       Textcolor(3);
       write(b[j,k],' ');
      end
    else if Itog(b[j,k])=2 then
      begin
       Textcolor(12);
       write(b[j,k],' ');
      end;
    writeln;
  end;
readln;
Textcolor(0);
for j:=1 to n do
  begin
    kp:=0;kn:=0;kv:=0;
    for k:=1 to n do
      begin
       if j<>k then
         if Itog(b[j,k])=0 then kp:=kp+1
         else if Itog(b[j,k])=1 then kn:=kn+1
         else if Itog(b[j,k])=2 then kv:=kv+1;
      end;
    writeln('U komandy ',j,' ',kv,' vyigr ',kn,' nich ',kp,' poraz');
  end;
readln
end.