import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
}

class MyException extends Exception{
  public MyException(String msg){
    super(msg);
  }
} import java.util.Scanner; Scanner java.util import java.util.regex.Pattern; Pattern java.util.regex import java.util.regex.Matcher; Matcher java.util.regex public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
} Main public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    } main {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String S = scan.next(); S scan.next() scan.next scan String T = scan.next(); T scan.next() scan.next scan if(S.length()<1 || S.length()>10) throw new MyException(""); S.length()<1 || S.length()>10 S.length()<1 S.length() S.length S 1 S.length()>10 S.length() S.length S 10 throw new MyException(""); new MyException("") if(T.length()<1 || T.length()>10) throw new MyException(""); T.length()<1 || T.length()>10 T.length()<1 T.length() T.length T 1 T.length()>10 T.length() T.length T 10 throw new MyException(""); new MyException("") if (!Pattern.matches("^[a-z]+$", S)) throw new MyException(""); !Pattern.matches("^[a-z]+$", S) Pattern.matches("^[a-z]+$", S) Pattern.matches Pattern "^[a-z]+$" S throw new MyException(""); new MyException("") if (!Pattern.matches("^[a-z]+$", T)) throw new MyException(""); !Pattern.matches("^[a-z]+$", T) Pattern.matches("^[a-z]+$", T) Pattern.matches Pattern "^[a-z]+$" T throw new MyException(""); new MyException("") if(S.equals(T)) throw new MyException(""); S.equals(T) S.equals S T throw new MyException(""); new MyException("") String As = scan.next(); As scan.next() scan.next scan String Bs = scan.next(); Bs scan.next() scan.next scan if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException(""); !Pattern.compile("^-?[0-9]+$").matcher(As).find() Pattern.compile("^-?[0-9]+$").matcher(As).find() Pattern.compile("^-?[0-9]+$").matcher(As).find Pattern.compile("^-?[0-9]+$").matcher(As) Pattern.compile("^-?[0-9]+$").matcher Pattern.compile("^-?[0-9]+$") Pattern.compile Pattern "^-?[0-9]+$" As throw new MyException(""); new MyException("") if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException(""); !Pattern.compile("^-?[0-9]+$").matcher(Bs).find() Pattern.compile("^-?[0-9]+$").matcher(Bs).find() Pattern.compile("^-?[0-9]+$").matcher(Bs).find Pattern.compile("^-?[0-9]+$").matcher(Bs) Pattern.compile("^-?[0-9]+$").matcher Pattern.compile("^-?[0-9]+$") Pattern.compile Pattern "^-?[0-9]+$" Bs throw new MyException(""); new MyException("") int A = Integer.parseInt(As); A Integer.parseInt(As) Integer.parseInt Integer As int B = Integer.parseInt(Bs); B Integer.parseInt(Bs) Integer.parseInt Integer Bs if(A<1 || A>10) throw new MyException(""); A<1 || A>10 A<1 A 1 A>10 A 10 throw new MyException(""); new MyException("") if(B<1 || B>10) throw new MyException(""); B<1 || B>10 B<1 B 1 B>10 B 10 throw new MyException(""); new MyException("") String U = scan.next (); U scan.next () scan.next scan if(!U.equals(S) && !U.equals(T)) throw new MyException(""); !U.equals(S) && !U.equals(T) !U.equals(S) U.equals(S) U.equals U S !U.equals(T) U.equals(T) U.equals U T throw new MyException(""); new MyException("") if(U.equals(S)) System.out.println((A-1) +" "+ B); U.equals(S) U.equals U S System.out.println((A-1) +" "+ B) System.out.println System.out System System.out (A-1) +" "+ B (A-1) +" "+ B (A-1) A 1 " " B if(U.equals(T)) System.out.println(A +" "+ (B-1)); U.equals(T) U.equals U T System.out.println(A +" "+ (B-1)) System.out.println System.out System System.out A +" "+ (B-1) A +" "+ (B-1) A " " (B-1) B 1 scan.close() scan.close scan String[] args args class MyException extends Exception{
  public MyException(String msg){
    super(msg);
  }
} MyException public MyException(String msg){
    super(msg);
  } MyException {
    super(msg);
  } super(msg) super msg String msg msg Exception public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
} public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
} Main
import java.util.Scanner;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class Main {
    public static void main(String[] args) throws MyException {
        
     // S,Tを入力
     Scanner scan = new Scanner(System.in);
     String S = scan.next();
     String T = scan.next();

     // S,Tは1文字以上10文字以下
     if(S.length()<1 || S.length()>10) throw new MyException("");
     if(T.length()<1 || T.length()>10) throw new MyException("");
     // S,Tは英字小文字からなる文字列
     if (!Pattern.matches("^[a-z]+$", S)) throw new MyException("");
     if (!Pattern.matches("^[a-z]+$", T)) throw new MyException("");

     // S≠T
     if(S.equals(T)) throw new MyException("");
          
     // A,Bを入力して下さい
    String As = scan.next();
    String Bs = scan.next();

     // A,Bは整数
     if(!Pattern.compile("^-?[0-9]+$").matcher(As).find()) throw new MyException("");
     if(!Pattern.compile("^-?[0-9]+$").matcher(Bs).find()) throw new MyException("");

    // A,Bを数値に変換
	int A = Integer.parseInt(As);
	int B = Integer.parseInt(Bs);

     // 1≦A, B≦10
     if(A<1 || A>10) throw new MyException("");
     if(B<1 || B>10) throw new MyException("");

     // Uを入力
     String U = scan.next ();
     // SまたはTと一致しなかったらエラー
     if(!U.equals(S) && !U.equals(T)) throw new MyException("");

     if(U.equals(S)) System.out.println((A-1) +" "+ B);
     if(U.equals(T)) System.out.println(A +" "+ (B-1));
          
     scan.close();
    }
}

class MyException extends Exception{
  public MyException(String msg){
    super(msg);
  }
}