import Control.Monad

main :: IO ()
main = do
  l1 <- replicateM 8 getLine
  l2 <- replicateM 8 getLine
  l3 <- replicateM 8 getLine
  let l1' = map words l1
      t1 = choiceTop' l1'
      r1 = rest l1' t1

      l2' = map words l2
      t2 = choiceTop' l2'
      r2 = rest l2' t2

      l3' = map words l3
      t3 = choiceTop' l3'
      r3 = rest l3' t3

      l4 = r1 ++ r2 ++ r3
      t4 = choiceTop' l4
      ans = t1 ++ t2 ++ t3 ++ t4
  mapM_ putStrLn (map format ans)
name :: [String] -> String
name [n,t] = n

time :: [String] -> Float
time [n,t] = (read :: String -> Float) t

choiceTop :: [[String]] -> [[String]] -> [[String]]
choiceTop sss [] = sss
choiceTop [] (s:ss) = choiceTop [s] ss
choiceTop (a:[]) (s:ss)
  |(time a) < (time s) = choiceTop (a:s:[]) ss
  | otherwise = choiceTop [s,a] ss
choiceTop [a,b] (s:ss)
  |(time a) >= (time s) = choiceTop [s,a] ss
  |(time b) >= (time s) = choiceTop [a,s] ss
  | otherwise = choiceTop [a,b] ss

choiceTop' :: [[String]] -> [[String]]
choiceTop' sss = choiceTop [] sss

rest :: [[String]] -> [[String]] -> [[String]]
rest all top = [s | s <- all , not (elem s top)]

format :: [String] -> String
format [n,t] = n ++ " " ++ t