import Control.Monad
import Control.Applicative
import Data.List

main = do
	n <- readLn
	l <- map (map (read :: String -> Int) . words) <$> replicateM ((n * (n - 1)) `div` 2) getLine
	mapM_ print $ solve n l

point :: [(Int, Int)] -> [Int] -> [(Int, Int)]
point x [a, b, c, d]
	| c < d = (b, 3):x
	| c == d = (a, 1):(b, 1):x
	| c > d = (a, 3):x

func :: Int -> Int -> [(Int, Int)] -> [(Int, Int)]
func a b [] = [(b, a)]
func a b ((x, y):z)
	| a == -1 = func x y z
	| x == a = func a (b + y) z
	| otherwise = (b, a):(func x y z)

func2 :: Int -> Int -> Int -> [(Int, Int)] -> [(Int, Int)]
func2 a b c [] = []
func2 a b c ((x, y):z)
	| a == -1 = (y, 1):(func2 x 1 2 z)
	| a == x = (y, b):(func2 x b (c + 1) z)
	| otherwise = (y, c):(func2 x c (c + 1) z)

func3 :: [(Int, Int)] -> [Int]
func3 l = map (\(x, y) -> y) $ sort l

solve :: Int -> [[Int]] -> [Int]
solve n l = func3 $ func2 (-1) (-1) (-1) $ reverse $ sort $ func (-1) (-1) $ sort $ foldl point [(x, 0) | x <- [1..n]] l