Pillar Grid

Sample Input

Sample Output