#include <iostream>
#include <queue>
using namespace std;
struct point{
int x, y, step;
bool is_juqi;
};
int n;
bool flag;
queue<point> q;
int a[1505][1505];
const int dx1[] = {0, 0, 1, -1};
const int dy1[] = {1, -1, 0, 0};
const int dx2[] = {0, 0, 2, -2};
const int dy2[] = {2, -2, 0, 0};
const int dx3[] = {1, -1, 1, -1};
const int dy3[] = {1, -1, -1, 1};
bool check(int x, int y)
{
if(x >= 0 && y >= 0 && x < n && y < n) return true;
return false;
}
void bfs(int x, int y, int step)
{
a[x][y] = 0;
q.push((point){x, y, 1, 0});
while(!q.empty())
{
point p = q.front();
q.pop();
if(p.is_juqi == 1){
p.is_juqi = 0;
p.step++;
q.push(p);
q.pop();
continue;
}
if((p.x == 1 && p.y == 1) || (p.x == 1 && p.y == n) || (p.x == n && p.y == 1)){
cout << p.step + 1;
flag = 1;
return;
}
for(int i = 0; i < 4; i++)
{
p = q.front();
p.x += dx1[i];
p.y += dy1[i];
p.step++;
p.is_juqi = 0;
if(check(p.x, p.y) && a[p.x][p.y] == 1)
{
a[p.x][p.y] = 0;
q.push(p);
}
}
for(int i = 0; i < 4; i++)
{
p = q.front();
p.x += dx2[i];
p.y += dy2[i];
p.step++;
p.is_juqi = 0;
if(check(p.x, p.y) && a[p.x][p.y] == 2)
{
a[p.x][p.y] = 0;
q.push(p);
}
}
for(int i = 0; i < 4; i++)
{
p = q.front();
p.x += dx3[i];
p.y += dy3[i];
p.step++;
p.is_juqi = 1;
if(check(p.x, p.y) && a[p.x][p.y] == 3)
{
a[p.x][p.y] = 0;
q.push(p);
}
}
}
}
int main()
{
cin >> n;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
char ch;
cin >> ch;
if(ch == '*') a[i][j] = 0;
else a[i][j] = ch - 'A' + 1;
}
}
if(n == 1 && a[1][1] != '*'){
cout << 1;
return 0;
}
if(a[n][n] == '*' || (a[1][n] == '*' && a[1][1] == '*' && a[n][1] == '*')){
cout << "No answer";
return 0;
}
bfs(n, n, 1);
if(!flag) cout << "No answer";
return 0;
}