title: Lexicographically sort an array of points
body: <p>I am trying to solve an NX2 array of all integers in lexicographic order. I am not getting a way how to achieve it. Also, this should be done is as least time as possible. Here's the example.</p>
  
  <p>Input</p>
  
  <pre><code>2 2
  1 1
  4 3
  2 1
  10 1
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>1 1
  2 1
  2 2
  4 3
  10 1
  </code></pre>