import java.util.Scanner; class Pair implements Comparable { int x, y; public Pair(String s) { String[] tmp = s.split("\\."); this.x = Integer.parseInt(tmp[0]); this.y = Integer.parseInt(tmp[1]); } @Override public int compareTo(Pair other) { if (this.x != other.x) return this.x - other.x; return this.y - other.y; } } public class whichoneislarger_mn { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String num1 = sc.nextLine(); String num2 = sc.nextLine(); Pair p1 = new Pair(num1); Pair p2 = new Pair(num2); double d1 = Double.parseDouble(num1), d2 = Double.parseDouble(num2); if (p1.compareTo(p2) < 0 && d1 < d2) { System.out.println(d2); } else if (p2.compareTo(p1) < 0 && d2 < d1) { System.out.println(d1); } else { System.out.println(-1); } sc.close(); } }