### classes

class Node
  attr_accessor :id, :lvds, :nbrs

  $nds = []
  $nn = 0
  
  def initialize(id)
    @id = id
    @lvds = []
    @nbrs = []
  end

  def self.add
    this = self.new($nn)
    $nds << this
    $nn += 1
    this
  end

  def self.clear
    $nds = []
    $nn = 0
  end
end

### subroutines

def same_dists(mtx, k)
  for nd in $nds
    sdist = mtx[k][0] - nd.lvds[0]
    ok = true
    for j in (1...k)
      d = mtx[k][j] - nd.lvds[j]
      if sdist != d
        ok = false
        break
      end
    end
    return [nd, sdist] if ok
  end
  [nil, nil]
end

### main

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

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

  Node.clear
  nd0 = Node.add
  nd0.lvds << 1
  
  for k in (1...n)
    cnd, sdist = same_dists(mtx, k)
    if cnd.nil?
      p "error"
      exit
    end
    
    while sdist > 1
      nd = Node.add
      cnd.nbrs << nd
      nd.nbrs << cnd
      nd.lvds = cnd.lvds.map{|d| d + 1}
      sdist -= 1
      cnd = nd
    end

    cnd.lvds[k] = 1
    q = [cnd]
    while ! q.empty?
      u = q.shift
      nvd = u.lvds[k] + 1
      for v in u.nbrs
        if v.lvds[k].nil?
          v.lvds[k] = 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