import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	}
} Main public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	} main {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) String s=sc.next(); s sc.next() sc.next sc String t=sc.next(); t sc.next() sc.next sc int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc String u=sc.next(); u sc.next() sc.next sc boolean x=true; x true if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		} s.length()==u.length()&&t.length()!=u.length() s.length()==u.length() s.length() s.length s u.length() u.length u t.length()!=u.length() t.length() t.length t u.length() u.length u x=true x true if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		} s.length()!=u.length()&&t.length()==u.length() s.length()!=u.length() s.length() s.length s u.length() u.length u t.length()==u.length() t.length() t.length t u.length() u.length u x=false x false {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		} for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		} int i=0; int i=0; i 0 i<s.length() i s.length() s.length s i++ i++ i {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		} {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		} if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			} s.charAt(i)!=u.charAt(i) s.charAt(i) s.charAt s i u.charAt(i) u.charAt u i {
				x=false;
			    break;
			} x=false x false break; if(x==true)
			a--;
		else
			b--; x==true x true a-- a b-- b pw.print(a+" "+b) pw.print pw a+" "+b a+" "+b a " " b pw.close() pw.close pw String[] args args static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	} Scanner StringTokenizer st; st BufferedReader br; br public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		} Scanner {
			br = new BufferedReader(new InputStreamReader(s));
		} br = new BufferedReader(new InputStreamReader(s)) br new BufferedReader(new InputStreamReader(s)) InputStream s s public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		} Scanner {
			br = new BufferedReader(new FileReader(file));
		} br = new BufferedReader(new FileReader(file)) br new BufferedReader(new FileReader(file)) String file file public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		} next {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		} while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine()); st == null || !st.hasMoreTokens() st == null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st public int nextInt() throws IOException {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() throws IOException {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public String nextLine() throws IOException {
			return br.readLine();
		} nextLine {
			return br.readLine();
		} return br.readLine(); br.readLine() br.readLine br public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public boolean ready() throws IOException {
			return br.ready();
		} ready {
			return br.ready();
		} return br.ready(); br.ready() br.ready br public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	}
} public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	}
} Main
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		String s=sc.next();
		String t=sc.next();
		int a=sc.nextInt();
		int b=sc.nextInt();
		String u=sc.next();
		boolean x=true;
		if(s.length()==u.length()&&t.length()!=u.length())
			x=true;
		else if(s.length()!=u.length()&&t.length()==u.length())
			x=false;
		else {
		for (int i=0;i<s.length();i++) {
			if(s.charAt(i)!=u.charAt(i)) {
				x=false;
			    break;
			}
		}
		}
		if(x==true)
			a--;
		else
			b--;
		pw.print(a+" "+b);
		pw.close();
	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}