n = gets.to_i

ab = []
f = Array.new(n+1){[]}
(n-1).times do |i|
    a, b = gets.split.map(&:to_i)
    f[a] << i
    f[b] << i
    ab << [a, b]
end

ans = Array.new(n-1)
que = [1]
color = Array.new(n+1){[]}
mc = 0

while x = que.shift
    c = 1

    f[x].each do |i|
        next if ans[i]
        y = ab[i][0] == x ? ab[i][1] : ab[i][0]

        while c == color[x][0]
            c += 1
            color[x].shift
        end

        ans[i] = c
        color[y] << c
        mc = c if mc < c
        que << y
        c += 1
    end
end

puts mc, ans