n = gets.to_i
points = []
(0..n-2).each do |i|
  points[i] = gets.split.map(&:to_i)
end
points_all = points.flatten!
points_counts = []
(1..n).each do |i|
  points_counts[i - 1] = points_all.count(i)
end
puts points_counts.max
lists = []
(0..n-2).each do |i|
  lists[i] = [points[i], 0]
end
# 提出用に適当
(0..n-2).each do |i|
  puts points_counts[i]
end
