unittest
{
	assert( [ "red blue", "3 4", "red" ].parse.expand.solve == "2 4" );
	assert( [ "red blue", "5 5", "blue" ].parse.expand.solve == "5 4" );
}



import core.bitop;
import std.algorithm;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto st = input.front.split.to!( dchar[][] );
	input.popFront;
	auto ab = input.front.split.to!( long[] );
	input.popFront;
	auto u = input.front.to!( dchar[] );
	return tuple( st[ 0 ], st[ 1 ], ab[ 0 ], ab[ 1 ], u );
}

auto solve( dchar[] s, dchar[] t, long a, long b, dchar[] u )
{
	if( s == u ) a--;
	if( t == u ) b--;
	return format( "%s %s", a, b );
}
