object Main {
  def main(args: Array[String]): Unit = {
    val colors       = io.StdIn.readLine.split(" ")
    val nums         = io.StdIn.readLine.split(" ").map{_.toInt}
    val select_color = scala.io.StdIn.readLine
    if( select_color == colors( 0 ) ) println( ( nums( 0 ) - 1 ) + " " + nums( 1 ) )
    else                              println( nums( 0 ) + " " + ( nums( 1 ) - 1 ) )
  }
}