import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

void main() {
  string[] st = readln.chomp.split;
  int[] ab = readln.chomp.split.to!(int[]);
  string u = readln.chomp;
  if(u==st[0]) ab[0]--;
  else if(u==st[1]) ab[1]--;
  writef("%d %d\n", ab[0], ab[1]);
}
