import java.io.IOException; import java.io.InputStream; import java.util.Arrays; import java.util.NoSuchElementException; class DJSet { int n; int[] upper,min,max; public DJSet(int n) { this.n=n; upper=new int[n]; min=new int[n]; max=new int[n]; Arrays.fill(upper, -1); for (int i=0;i Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next());} }