import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.util.InputMismatchException; import java.io.OutputStream; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.math.BigDecimal; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); PrintWriter out = new PrintWriter(outputStream); Task solver = new Task(); solver.solve(1, in, out); out.close(); } static class Task { public void solve(int testNumber, InputReader in, PrintWriter out) { String[] S = new String[2]; String[] P = new String[2]; String[] X = new String[2]; for(int i=0; i<2; i++){ S[i] = in.next(); P[i] = in.next(); X[i] = in.next(); } int win=-1; if(P[0].length()P[1].length()){ out.println(S[0]); return; } for(int i=0; i<10000; i++){ if(P[0].charAt(i)>P[1].charAt(i)){ win=0; break; } if(P[0].charAt(i)