#include <map>
#include <string>
#include <iostream>
#include <ios>
#include <set>
#include <iomanip>
#include <fstream>
using namespace std;

class Date
{
public:
  int year, month, day;
  friend ostream& operator<< (ostream& s, const Date& d);
  friend istream& operator>> (istream& s, Date& d);
  bool operator< (const Date& d) const
  {
    if(year!=d.year)
      return year<d.year;
    else if(month!=d.month)
      return month<d.month;
    else
      return day<d.day;
  }
};

ostream& operator<< (ostream& s, const Date& d)
{
  return s<<right<<setfill('0')<<setw(4)<<d.year<<'/'<<setw(2)<<d.month<<'/'<<setw(2)<<d.day<<setfill(' ');
}

istream& operator>> (istream& s, Date& d)
{
  string v;
  s>>v;
  sscanf(v.c_str(),"%d/%d/%d",&d.year,&d.month,&d.day);
  return s;
}

struct Key
{
  string name;
  Date date;
};

struct keyless
{
  bool operator() (const Key& _Left, const Key& _Right) const
  {
    if(_Left.name==_Right.name)
      return _Left.date<_Right.date;
    else
      return _Left.name<_Right.name;
  }
};

int main(void)
{
  //fstream cin;
  //cin.open("in.txt", ios_base::in);
  map<Key,int,keyless> marks;
  set<Date> dates;
  set<string> names;
  Key key;
  int mark;
  int l=0;
  while(cin>>key.name>>key.date>>mark)
  {
    marks[key]=mark;
    l=max(l,(int)key.name.length());
    dates.insert(key.date);
    names.insert(key.name);
  }
  cout<<left;
  cout<<setw(l)<<'.';
  for(set<Date>::iterator i=dates.begin(); i!=dates.end(); i++)
    cout<<' '<<setw(10)<<*i;
  cout<<'\n';
  cout<<left;
  for(set<string>::iterator i=names.begin(); i!=names.end(); i++)
  {
    cout<<setw(l)<<*i<<' ';
    for(set<Date>::iterator j=dates.begin(); j!=dates.end(); j++)
    {
      key.name=*i;
      key.date=*j;
      if(marks.find(key)==marks.end() )
        cout<<setw(10)<<'.'<<' ';
      else
        cout<<setw(10)<<marks[key]<<' ';
    } 
    cout<<'\n';
  } 

  //scanf("%d");
  return 0;  
}










