import Control.Monad
import Data.Vector (Vector, (!), (//))
import qualified Data.Vector as V

main = do
  [n,m] <- map read.words <$> getLine
  passes <- replicateM m $ (\[a,b]->(a-1,b-1)).map read.words <$> getLine
  mapM_ print $ reverse $ solve (V.fromList $ zip [0..n-1] $ repeat 1) (reverse passes) (n*(n-1)`div`2)

solve _ [] _ = []
solve v (p@(a,b):ps) dc
  | parent a == parent b  = dc : solve v ps dc
  | otherwise = dc : solve union ps (dc - member a * member b)
  where
  union
    | as > bs   = v // [(ap,(ap,as+bs)),(b,(ap,as+bs)),(bp,(ap,as+bs))]
    | otherwise = v // [(a,(bp,as+bs)),(bp,(bp,as+bs)),(ap,(bp,as+bs))]
    where ((ap,as), (bp,bs)) = (v!a, v!b)
  parent = fst.find
  member = snd.find
  find i
    | p == i    = (p,s)
    | otherwise = find p
    where (p,s) = v!i