n = gets.to_i
@map = []
(n+1).times { @map << [] }
ans = []
k = 1
def calc_k(ai, bi)
  oc = [@map[ai],@map[bi]].flatten.uniq.sort
  k = 1
  loop do
    if oc.include?(k)
      k += 1
    else
      break
    end
  end
  k
end
(n-1).times {
  ai, bi = gets.split.map(&:to_i)
  k = calc_k(ai, bi)
  ans << k
  @map[ai] << k
  @map[bi] << k
}
p ans.max
puts ans
