import Data.Array
import Data.Array.ST

counter::Int -> [(Int,Int)] -> Array Int Int
counter n path = runSTArray $ do
              ar<-newArray (1,n) 0
              mapM_ (writer ar) path
              return ar
                where writer ar (a,b) = do
                                v<-readArray ar a
                                writeArray ar a (v+1)
                                v<-readArray ar b
                                writeArray ar b (v+1)

n_get::Int ->IO [(Int,Int)]
n_get 0 =return []
n_get n =do
  d<-getLine
  let a:b:[]= map read (words d)
  rest <- n_get (n-1)
  return ((a,b):rest)

print_n::[Int] -> IO()
print_n []= return ()
print_n (x:xs)=do
  print x
  print_n xs

main::IO()
main=do
  nmc<-getLine
  let n:m:[]=map read (words nmc)
  dat<-n_get m
  print_n (elems (counter n dat))
