#include<iostream>
#include<limits.h>
#include<queue>
#include<vector>
#define MAX_V_NUM 100 //顶点的最大个数
using namespace std;
struct Box
{
int x;
int y;
int lastIndex;
int index;
};
int main()
{
vector<Box> vec;
int size;
int map[MAX_V_NUM][MAX_V_NUM] = { 0 };
int visit[MAX_V_NUM][MAX_V_NUM] = { 0 };
cin >> size;
for (int i = 0; i < size + 2; i++)
for (int j = 0; j < size + 2; j++)
cin >> map[i][j];
queue<Box> qu;
Box start = { 1,1,-1,0};
vec.push_back(start);
qu.push(start);
visit[1][1] = 1;
while (!qu.empty())
{
Box temp = qu.front();
if (temp.x == size && temp.y == size)break;
qu.pop();
if (map[temp.x + 1][temp.y] == 0&&visit[temp.x+1][temp.y]==0)
{
Box box = { temp.x + 1,temp.y,temp.index,vec.size() };
qu.push(box);
vec.push_back(box);
visit[temp.x + 1][temp.y] = 1;
}
if (map[temp.x][temp.y+1] == 0 && visit[temp.x][temp.y+1] == 0)
{
Box box = { temp.x ,temp.y+1,temp.index,vec.size() };
qu.push(box);
vec.push_back(box);
visit[temp.x][temp.y+1] = 1;
}
if (map[temp.x][temp.y -1] == 0 && visit[temp.x][temp.y -1] == 0)
{
Box box = { temp.x ,temp.y -1,temp.index,vec.size() };
qu.push(box);
vec.push_back(box);
visit[temp.x][temp.y -1] = 1;
}
}
if (qu.empty())
{
cout << "no path";
}
else
{
cout << "Find path"<<endl;
int index[MAX_V_NUM] = { 0 };
int i = 0;
Box temp = qu.front();
qu.pop();
while (temp.lastIndex!=-1)
{
index[i++]=temp.index;
temp = vec[temp.lastIndex];
}
cout << 1 << ' ' << 1 << endl;
for (int j = i-1; j>=0; j--)
cout << vec[index[j]].x << ' ' << vec[index[j]].y << endl;
}
return 0;
}