program main
  integer(16)::n,i,j,k,price,ma,cnt
  integer,allocatable::a(:),ans(:)
  !character(*)::s
read(*,*)n
allocate(a(2*n),ans(n-1))
a=0

do i=1,n-1
  read(*,*) a(2*i-1),a(2*i)
  cnt=1
  x=a(2*i-1)
  do j=1,2*i-2
    if(x.eq.a(j)) cnt=cnt+1
  end do
  x=a(2*i)
  do j=1,2*i-2
    if(x.eq.a(j)) cnt=cnt+1
  end do
  ans(i)=cnt
end do

write(*,*) maxval(ans)
do i=1,n-1
write(*,*) ans(i)
end do
stop
end program
