import java.io.*; 
import java.lang.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
public static void main(String[] args){
try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){}
}
} import java.io.*; io.* java import java.lang.*; lang.* java import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main{
public static void main(String[] args){
try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){}
}
} Main public static void main(String[] args){
try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){}
} main {
try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){}
} try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){} catch(Exception e){} Exception e {} {
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) String b = reader.readLine(); b reader.readLine() reader.readLine reader String c = reader.readLine(); c reader.readLine() reader.readLine reader String d = reader.readLine(); d reader.readLine() reader.readLine reader String parts[] = b.split(" "); parts b.split(" ") b.split b " " String S = parts[0]; S parts[0] parts 0 String T = parts[1]; T parts[1] parts 1 String parts2[] = c.split(" "); parts2 c.split(" ") c.split c " " int n1 = Integer.parseInt(parts2[0]); n1 Integer.parseInt(parts2[0]) Integer.parseInt Integer parts2[0] parts2 0 int n2 = Integer.parseInt(parts2[1]); n2 Integer.parseInt(parts2[1]) Integer.parseInt Integer parts2[1] parts2 1 if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  } d.compareTo(S)==0 d.compareTo(S) d.compareTo d S 0 {
    System.out.println((n1 - 1) +" "+n2);} System.out.println((n1 - 1) +" "+n2) System.out.println System.out System System.out (n1 - 1) +" "+n2 (n1 - 1) +" "+n2 (n1 - 1) n1 1 " " n2 if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  } d.compareTo(T)==0 d.compareTo(T) d.compareTo d T 0 {
     System.out.println(n1  +" "+(n2-1));
  } System.out.println(n1  +" "+(n2-1)) System.out.println System.out System System.out n1  +" "+(n2-1) n1  +" "+(n2-1) n1 " " (n2-1) n2 1 {
     System.out.println(n1  +" "+(n2));
  } System.out.println(n1  +" "+(n2)) System.out.println System.out System System.out n1  +" "+(n2) n1  +" "+(n2) n1 " " (n2) String[] args args
import java.io.*; 
import java.lang.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
public static void main(String[] args){
try{
   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String b = reader.readLine();
     String c = reader.readLine();
     String d = reader.readLine();
    String parts[] = b.split(" ");
    String S = parts[0];
  String T = parts[1];
  String parts2[] = c.split(" ");
  int n1 = Integer.parseInt(parts2[0]);
  int n2 = Integer.parseInt(parts2[1]);
  if(d.compareTo(S)==0){
    System.out.println((n1 - 1) +" "+n2);}else if(d.compareTo(T)==0){
     System.out.println(n1  +" "+(n2-1));
  }else{
     System.out.println(n1  +" "+(n2));
  }
}catch(Exception e){}
}
}