import java.util.*;
class Main{
 public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String j = sc.next();
   if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   }
   System.out.println(c);
   System.out.println(d);
 } 
} import java.util.*; util.* java class Main{
 public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String j = sc.next();
   if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   }
   System.out.println(c);
   System.out.println(d);
 } 
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String j = sc.next();
   if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   }
   System.out.println(c);
   System.out.println(d);
 } main {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String j = sc.next();
   if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   }
   System.out.println(c);
   System.out.println(d);
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String a = sc.next(); a sc.next() sc.next sc String b = sc.next(); b sc.next() sc.next sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc String j = sc.next(); j sc.next() sc.next sc if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   } a.equals(j) a.equals a j {
     c = c - 1;
   } c = c - 1 c c - 1 c 1 if(b.equals(j)){
   d = d - 1; 
   } b.equals(j) b.equals b j {
   d = d - 1; 
   } d = d - 1 d d - 1 d 1 System.out.println(c) System.out.println System.out System System.out c System.out.println(d) System.out.println System.out System System.out d String[] args args
import java.util.*;
class Main{
 public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    int c = sc.nextInt();
    int d = sc.nextInt();
    String j = sc.next();
   if(a.equals(j)){
     c = c - 1;
   } else if(b.equals(j)){
   d = d - 1; 
   }
   System.out.println(c);
   System.out.println(d);
 } 
}