title: Building a tower from cubes
body: <p>You can make stable tower from cubes by not putting bigger to a smaller one and you can't put heavier to a lighter cube.</p>
  
  <p>Write a program which gives you the highest tower from N cubes.</p>
  
  <p>The first row of the input txt contains the number of cubes. (1&lt;=n&lt;=100) In the following N rows there are the cube's length and weight.</p>
  
  <p>Example:</p>
  
  <pre><code>Input.txt       Output.txt (from bottom to top)
  5               3
  10 3            20 5
  20 5            10 3
  15 6            10 2
  15 1
  10 2
  </code></pre>
  
  <p>Memory limit: 16 mb Running Time: 0.2 sec</p>
  
  <p>Can you help me?</p>