-- https://atcoder.jp/contests/abc042/tasks/abc042_b

import Control.Monad
import Data.List
import Data.Monoid ((<>))

main :: IO ()
main = do
  [n, _] <- map read . words <$> getLine
  ss <- mapM (const getLine) [1 .. n]
  putStrLn . head . sort $ do
    x <- ss
    y <- ss
    z <- ss
    guard $ x /= y && y /= z && x /= z
    pure $ x <> y <> z
