Utility Pair implementation
static class Pair implements Comparable < Pair > { int num_sticks ; String str ; Pair ( int n , String s ) { num_sticks = n ; str = s ; } public int compareTo ( Pair p ) { return this . num_sticks - p . num_sticks ; } }