import Data.List
f a r = if null a then r else f (tail a) ((take ((head.head)a) r)++[(r!!((head.head)a))+1]++(((take (((last.head)a)-((head.head))a-1)).(drop ((head.head)a+1))) r)++[(r!!((last.head)a))+1]++(drop ((last.head)a+1) r))
main=do
 [n,m]<-map read.words<$>getLine ::IO[Int]
 a<-map (map (+(-1)).sort.(map read)).map words.lines<$>getContents
 putStr$unlines$map show$f a (replicate n 0)