Help,could you tell me what's the problem of my procedure?
#include <stdio.h>
static int map[11][11];
int q[150][2];
int N,i,j;
int x,y,a,b;
int head,tail;
int main()
{
scanf("%d",&N);
a = 10,b = 10;
for(i = 0;i < N;i++)
{
scanf("%d%d",&x,&y);
map[x][y] = 1;
if(x < a)
{
a = x,b = y;
}
else if(x == a && y < b)
{
a = x,b = y;
}
scanf("\n");
}
printf("%d %d\n",a,b);
for(head = 0,tail = head + 1,q[head][0] = a,q[head][1] =
b,map[a][b] = 2;head < tail;head++)
{
x = q[head][0];
y = q[head][1];
if(map[x + 1][y] == 1)
{
map[x + 1][y] = 2;
q[tail][0] = x + 1;
q[tail++][1] = y;
printf("R");
}
if(map[x][y + 1] == 1)
{
map[x][y + 1] = 2;
q[tail][0] = x;
q[tail++][1] = y + 1;
printf("T");
}
if(map[x - 1][y] == 1)
{
map[x - 1][y] = 2;
q[tail][0] = x - 1;
q[tail++][1] = y;
printf("L");
}
if(map[x][y - 1] == 1)
{
map[x][y - 1] = 2;
q[tail][0] = x;
q[tail++][1] = y - 1;
printf("B");
}
map[x][y] = 3;
if(tail - 1 == head)
printf(".\n");
else
printf(",\n");
}
return 0;
}