#include <stdio.h>
#include <stdlib.h>

#define W 8
#define H 6

char map[H][W] = {
    {1,1,1,1,1,1,1,1},
    {1,0,0,0,0,0,0,1},
    {1,0,1,1,1,0,1,1},
    {1,0,0,0,0,1,0,1},
    {1,0,0,1,0,0,2,1},
    {1,1,1,1,1,1,1,1},
};

void maze1(int x, int y, int depth)
{
    int i;

    for(i = 0; i < depth * 2; i++)
    {
        printf(" ");
    }

    if(map[y][x] == 0)
    {
        printf("(%d,%d)\n", x, y);

        maze1(x + 1, y, depth + 1);  // 右
        maze1(x, y + 1, depth + 1);  // 下
    }
    else if(map[y][x] == 1)
    {
        printf("(%d,%d)X\n", x, y);
    }
    else if(map[y][x] == 2)
    {
        printf("(%d,%d)OK\n", x, y);
        exit(0);
    }
}

int main(void)
{
    maze1(1, 1, 0);

    return 0;
}