open System type Sol() = member this.Solve() = let A = stdin.ReadLine().Split(); let B = stdin.ReadLine().Split(); let comp s t = if Seq.length s > (Seq.length t) then 1 elif Seq.length s < (Seq.length t) then -1 else let st = Seq.zip s t |> Seq.toArray let res = Seq.tryFindIndex (fun p -> (fst p) <> (snd p) ) st if Option.isNone res then 0 else (if fst (st.[Option.get res]) > (snd (st.[Option.get res])) then 1 else -1) let ans = match (comp A.[1] B.[1]) with | 1 -> A.[0] | -1 -> B.[0] | _ -> "-1" printfn "%s" ans let mySol = new Sol() mySol.Solve()