# https://atcoder.jp/contests/abc154/tasks/abc154_a

read row ; row=($row) ; S=${row[0]} ; T=${row[1]}
read row ; row=($row) ; a=$((${row[0]})) ; b=$((${row[1]}))
read U
if [ $U = $S ] ; then
  a=$(($a-1))
fi
if [ $U = $T ] ; then
  b=$(($b-1))
fi
echo $a $b
