### classes

class Node
  attr_accessor :id, :lvds, :nbrs

  def initialize
    @id = $nn
    $nn += 1
    @lvds = []
    @nbrs = []
    $nds << self
  end

  def to_s
    [@id, @lvds, @nbrs.map{|nd| nd.id}]
  end
end

### subroutines

def right_direc(mtx, k, nd0, nd1)
  for i in (0...k)
    dki = mtx[k][i] - 1
    d0 = (dki - nd0.lvds[i]).abs
    d1 = (dki - nd1.lvds[i]).abs
    return false if d0 < d1
  end
  true
end

### main

loop do
  n = gets.to_i
  break if n == 0

  mtx = n.times.map{gets.split.map(&:to_i)}
  #p mtx

  lvs = []
  $nds = []

  $nn = 0
  nd0 = Node.new
  nd0.lvds[0] = 1
  lvs[0] = nd0

  for i in (1...n)
    #p ["i", i]
    cnd = lvs[0]

    loop do
      #p ["cnd", cnd.id]
      nnd = nil
      for nd in cnd.nbrs
        if right_direc(mtx, i, cnd, nd)
          nnd = nd
          break
        end
      end
      break if nnd.nil?

      cnd = nnd
    end

    while mtx[i][0] - cnd.lvds[0] > 1
      nd = Node.new
      cnd.nbrs << nd
      nd.nbrs << cnd
      (0...i).each{|j| nd.lvds[j] = cnd.lvds[j] + 1}
      cnd = nd
    end

    lvs[i] = cnd
    cnd.lvds[i] = 1
    q = [cnd]
    while ! q.empty?
      u = q.shift
      nvd = u.lvds[i] + 1
      for v in u.nbrs
        if v.lvds[i].nil?
          v.lvds[i] = nvd
          q << v
        end
      end
    end
    #p lvs.map{|nd| nd.id}
    #p $nds.map{|nd| nd.to_s}
  end

  ndegs = $nds.map{|nd| nd.nbrs.length + nd.lvds.count{|d| d == 1}}
  puts ndegs.sort.join(' ')
end