import java.lang.*;
import java.util.*;

class a {
  static class MyStruct {
    public int a, b;
    public MyStruct( int a, int b ) {
      this.a = a;
      this.b = b;
    }
  }
  static public void main( String[] args ) {
    List<MyStruct> array = Arrays.asList(new MyStruct[] {new MyStruct(1, 2), new MyStruct(3, 4), new MyStruct(3, 0), new MyStruct(0, 0)});
    //Collections.sort(array, (x, y) -> ((x.a != y.a) ? (x.a - y.a) : (x.b - y.b)));
    array.sort((x, y) -> ((x.a != y.a) ? (x.a - y.a) : (x.b - y.b)));
    for (MyStruct x : array)
      System.out.println(x.a + ", " +  x.b);
  }
}