import java.util.*; public class Main { public Main() { } public String getResult(int n) { List<List<Integer>> layers = new LinkedList<>(); for (int i = 0, num = 1; i < n; i++) { List<Integer> layer = new LinkedList<>(); layer.add(num++); layers.add(layer); for (int j = layers.size() - 2; j >= 0; j--) { layers.get(j).add(num++); } } StringBuilder s = new StringBuilder(); for (List<Integer> layer : layers) { for (int i : layer) { s.append(i).append(" "); } s.append("\n"); } return s.toString(); } public static void main(String[] args) { Main solution = new Main(); Scanner in = new Scanner(System.in); while (in.hasNext()) { int n = Integer.parseInt(in.next()); String res = solution.getResult(n); System.out.print(res); } } }