#!/usr/bin/perl
%data = ();
$last = '';
while (<STDIN>)
{
  chomp;
  ($k, $p, $rate) = split('\t', substr($_, 8));
  $data{$k}{$p} = $rate;
}
print "P";
for ($i = 0; $i <= 20; $i+=2)
{
  print "\t", $i;
}
print "\n";
foreach $key (sort(keys %{$data{"0"}}))
{
  print $key;
  for ($i = 0; $i <= 20; $i+=2)
  {
    print "\t", $data{$i}{$key};
  }
  print "\n";
}
