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

class a {
  static class MyStruct implements Comparable<MyStruct> {
    public int a, b;
    public MyStruct( int a, int b ) {
      this.a = a;
      this.b = b;
    }
    public int compareTo( MyStruct x ) {
      if (a != x.a)
        return a - x.a;
      return b - x.b;
    }
  }
  static public void main( String[] args ) {
    MyStruct a[] = new MyStruct[] {new MyStruct(1, 2), new MyStruct(3, 4), new MyStruct(3, 0), new MyStruct(0, 0)};
    Arrays.sort(a);
    for (int i = 0; i < a.length; i++)
      System.out.println(a[i].a + ", " +  a[i].b);
  }
}