using System;
public class Program{
public static void Main(){
bool g = true; // true -- прямой порядок
for(int a = 1; a <= 9; a++){
for(int b = 1; b <= (10 - a); b++){
if(g){
Console.Write(b);
}
else{
int c = 11 - a - b;
Console.Write(c);
//if(g){g = false;} else {g = true;}
g = !g;
Console.WriteLine();