title: Represent a table as a matrix
body: <p>Suppose I have a database table with 3 fields: string title, int A, int B. 
  A range of both A and B is 1 to 500.<br>
  I want to represent part of the values as a matrix 5x5.
  So that (1, 1) will be string which has lowest both A and B; 
  (5, 5) will have highest both A and B;
  (1, 5) will have lowest A and highest B. And so on.<br>
  Which algorithm should I use?</p>