the input is a sequence of datasets. the end of the input is indicated by a line containing two zeros separated by a space. the number of datasets never exceeds 100. each dataset is formatted as follows. the width(=w) and the height(=h) of
the input is a sequence of datasets. the end of the input is indicated by a line containing two zeros separated by a space. the number of datasets never exceeds 100.
each dataset is formatted as follows.
the width(=w) and the height(=h) of the board
first row of the board
...
h-th row of the board
the width and the height of the board satisfy: 2 w h
each line consists of w decimal numbers delimited by a space. the number describes the status of the corresponding square.
0 vacant square
1 block
2 start position
3 goal position
the dataset for fig. d-1 is as follows:
6 6
1 0 0 2 1 0
1 1 0 0 0 0
0 0 0 0 0 3
0 0 0 0 0 0
1 0 0 0 0 1
0 1 1 1 1 1
