import sys
import os
from copy import *
from types import *
from random import *
import Genome
import History

if len(sys.argv) != 4:
  print "Usage: python tab.py [strom] [genomy v listoch] [historia]"
  sys.exit(1)

tree = sys.argv[1]
leaves = sys.argv[2]
hist = sys.argv[3]

History.init (tree)
h = History.History(leaves)
h.read(hist)

T = h.dist_tab()
for i in xrange(0, History.n):
  print History.name[i],
  for j in xrange(0, History.n):
    if i==j: print " 0",
    elif i>j: print "%2d" % T[i][j],
    else: print "%2d" % T[j][i],
  print
    

