ArrayLists to store maximum and minimum of all the four forms
ArrayList < Integer > V = new ArrayList < > ( ) ; ArrayList < Integer > V1 = new ArrayList < > ( ) ; for ( int i = 0 ; i < N ; i ++ ) { V . add ( A . get ( i ) . x + A . get ( i ) . y ) ; V1 . add ( A . get ( i ) . x - A . get ( i ) . y ) ; }