import scala.collection.mutable
object Main extends App {
  import scala.io.StdIn._

  val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
  val inEdgeCount = Array.tabulate(n){_ ⇒ 0}
  val edges = Array.tabulate(n){_ ⇒ Nil: List[Int]}
  for (_ ← 1 until n + m){
    val Array(a, b) = readLine.trim.split(' ').map(_.toInt - 1)
    inEdgeCount(b) += 1
    edges(a) ::= b
  }
  val root = inEdgeCount.indexWhere(_ == 0)
  println(bfs(root).mkString("\n"))
  def bfs(root: Int): Array[Int] = {
    val prevs = Array.tabulate(n){_ ⇒ 0}
    val queue = mutable.Queue[Int](root)
    while(queue.nonEmpty){
      val top = queue.dequeue()
      for (next ← edges(top)) {
        queue.enqueue(next)
        prevs(next) = top + 1
      }
    }
    prevs
  }
}