private static class Pair{
int x,y;
public Pair(){
this.x=0;
this.y=0;
}
}
static void sortPair(Pair a[]){
Arrays.sort(a,new Comparator<Pair>(){
@Override public int compare(Pair p1,Pair p2){
return p1.x-p2.x;
}
});
}