object Main {

  def main(args: Array[String]) {
    val lines = io.Source.stdin.getLines
    val numLines = lines.next().toInt

    val result = lines.map(_.groupBy(identity).mapValues(_.length)).reduce(mergeMap).toList.sortBy(_._1).map((x) => x._1.toString * x._2).mkString("")

    println(result)
  }

  def mergeMap(map1: Map[Char, Int], map2: Map[Char, Int]): Map[Char, Int] = {
    val result = scala.collection.mutable.Map[Char, Int]()

    for ((k, v) <- map1) {
      if (map2 contains k) {
        result(k) = Math.min(v, map2(k))
      }
    }

    result.toMap
  }
}
