import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

ss, st = ins().split()
a, b = inm()
su = ins()


def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1)


print(*solve()) import sys sys sys.setrecursionlimit(10 ** 8) sys.setrecursionlimit sys setrecursionlimit 10 ** 8 10 8 ini = lambda: int(sys.stdin.readline()) ini lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline inm = lambda: map(int, sys.stdin.readline().split()) inm lambda: map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split inl = lambda: list(inm()) inl lambda: list(inm()) list(inm()) list inm() inm ins = lambda: sys.stdin.readline().rstrip() ins lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print "\033[33m" *a a "\033[0m" **dict(file=sys.stderr, **kw) dict(file=sys.stderr, **kw) dict file=sys.stderr file sys.stderr sys stderr **kw kw *a **kw ss, st = ins().split() ss ins().split() ().split () ins split st a, b = inm() a inm() inm b su = ins() su ins() ins def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1) solve if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1) su == ss su ss return (a - 1), b return (a - 1), b a - 1 a 1 b return a, (b - 1) return a, (b - 1) a b - 1 b 1 print(*solve()) print *solve() solve() solve su = ins() ins() su inl = lambda: list(inm()) lambda: list(inm()) inl ss, st = ins().split() ins().split() ss st = ins().split() ins().split() st ini = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ini def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1) def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1) solve ins = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() ins a, b = inm() inm() a inm = lambda: map(int, sys.stdin.readline().split()) lambda: map(int, sys.stdin.readline().split()) inm debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug b = inm() inm() b
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

ss, st = ins().split()
a, b = inm()
su = ins()


def solve():
    if su == ss:
        return (a - 1), b
    else:
        return a, (b - 1)


print(*solve())
