import java.util.Scanner

object Main {
  def solve(sc: => Scanner): Unit = {
    println(Array.fill[Int](sc.nextInt)(sc.nextInt).combinations(2).toList.map(A => Array(A.mkString("").toInt, A.reverse.mkString("").toInt)).flatten.sorted.apply(2))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}