#pragma GCC optimize("-O3")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std;

using l =long int;
using ll =long long int;
#define imax INT_MAX
#define lmax LLONG_MAX
#define pb push_back
#define ld long double
#define pii pair<l,l> 
#define pll pair<ll,ll>
#define v vector
#define vl vector<l>
#define vll vector<ll>
#define vvl vector<vector<l>>
#define vvll vector<vector<ll>>
#define vv(a) vector<vector<a>> 
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define mini(a,i,j) *min_element((a).begin()+i,(a).begin()+j)
#define maxi(a,i,j) *max_element((a).begin()+i,(a).begin()+j)
#define sum_vec(a) accumulate(all(a),0)
#define trans_lower(s) transform(all(s),s.begin(),::tolower)
#define trans_upper(s) transform(all(s),s.begin(),::toupper)
#define f first
#define se second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define rep(i, begin, end) \
        for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define tc l t=0;cin>>t;while(t--)
#define tc_1 l t=1;while(t--)

// ONLINE JUDGE START
#ifndef ONLINE_JUDGE
    // FILE
    #define file ifstream cin; cin.open("input.txt");  ofstream cout; cout.open("output.txt");
    // DEBUG
    #define debug(x) cout<<"LINE NUMBER:     "<<__LINE__<<"\t :--> \t"<<#x<<"   =   "<<x<<endl;
#else 
    #define debug(x) 
#endif

// SYSTEM
#define DeBuG(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#define time__(d) for(long blockTime=NULL;(blockTime==NULL?(blockTime=clock())!=NULL:false); \
            DeBuG("%s:%.4f s\n",d,(double)(clock()-blockTime)/CLOCKS_PER_SEC))
// OVERLOADING
istream& operator >> (istream& cin,vll &a){
    for(auto &i:a)cin>>i;
    return cin;
}
ostream& operator << (ostream& cout,const pll &a){
    cout<<a.f<<" "<<a.se<<"\t";
    return cout;
}
ostream& operator << (ostream& cout,vl &a){
    for(auto &i:a)cout<<i<<" ";
    return cout;
}
ostream& operator << (ostream& cout,vll &a){
    for(auto &i:a)cout<<i<<" ";
    return cout;
}
ostream& operator << (ostream& cout,v<pll> &a){
    for(auto &i:a)cout<<i<<"\t";
    return cout;
}
ostream& operator << (ostream& cout,vvl &a){
    for(auto &i:a){cout<<i<<endl;}
    return cout;
}
ostream& operator << (ostream& cout,vvll &a){
    for(auto &i:a){cout<<i<<endl;}
    return cout;
}
ostream& operator << (ostream& cout,unordered_map<ll,bool> &a){
    for(auto &i:a){cout<<i.f<<" "<<i.se<<"\t";}
    return cout;
}
ostream& operator << (ostream& cout,map<ll,ll> &a){
    for(auto &i:a){cout<<i.f<<" "<<i.se<<"\t";}
    return cout;
}
ostream& operator << (ostream& cout,set<ll> &a){
    for(auto i:a)cout<<i<<" ";
    return cout;
}
template<class T> void refresh(T &a,ll n){
    a.clear();a.resize(n);
}
template<class X,class Y>void refresh_with_value(X &a,ll n,Y value){
    a.clear();a.resize(n,value);
}
void Unique(vll &a){
    sort(all(a));
    auto it=unique(all(a));
    a.resize(distance(a.begin(),it));
}


// GLOBAL VARIABLE AND FUNTIONS
const ll inf = 1e9+7;

int main()
{
    fast;
#ifndef ONLINE_JUDGE
    // file;
#endif

    string a,b;cin>>a>>b;
    ll n,m;cin>>n>>m;
    string c;cin>>c;
    if(c==a)cout<<n-1<<" "<<m;
    else cout<<n<<" "<<m-1;

#ifndef ONLINE_JUDGE
    // cerr << "Time elapsed: " << 1000.0 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
    return 0;
}


Measured memory_bytes: 256