#797. 一次性走完的#

一次性走完的#

No testdata at current.

No submission language available for this problem.

Background

Special for beginners, ^_^

Description

有一个 hhww 列的方阵,每个方格中不是#就是.。现在请你找出一条这样的路径:从一个为#的格子出发,不重复地经过每一个为#的格子。找出任意一条这样的路径即可。

Format

Input

第一行输入行数 hh 和列数 ww,接下来输入这个方阵。

Output

第一行输出为#的格子个数,第二行按顺序输出这条路径所经过的每一个格子的横坐标和纵坐标。

Samples

3 3
##.
.##
###
7
1 1
1 2
2 2
2 3
3 3
3 2
3 1
3 4
####
####
.#..
9
1 4
2 4
2 3
1 3
1 2
1 1
2 1
2 2
3 2
3 3
.##
###
###
8
1 2
1 3
2 3
2 2
2 1
3 1
3 2
3 3

Limitation

1h,w41\le h,w\le4