Utility function to find minimum of pair type values
static Pair < Integer , Integer > min ( Pair < Integer , Integer > a , Pair < Integer , Integer > b ) { if ( a . first <= b . first ) return a ; return b ; }