// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 1e-9
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
// mylittledoge
using namespace std;
struct cell {
bool A;
bool B[8];
// N cells: U,L,D,R,UL,DL,DR,UR
int diag[4];
// N cells: minor,major diagonal start,end
cell() {
A =true;
for(int i =0; i < 4; i++) {
B[i] =B[i+4] =false;
diag[i] =0;}
}
};
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int N,a;
cin >> N;
vector< pair<int,int> > shops;
for(int i =0; i < N*N; i++) {
cin >> a;
if(a) shops.push_back(make_pair(i/N,i%N));}
if(shops.size() > 2*N+patkan) {
for(int i =0; i < N*N; i++)
cout << "N" << ((i%N == N-1)?"\n":" ");
return 0;}
vector< vector<cell> > A(N,vector<cell>(N));
for(int k =0; k < 4; k++) {
ALL_THE(shops,it) ALL_THE(shops,jt) if(it->ff <= jt->ff && it->ss <= jt->ss) {
if((jt->ff-it->ff+jt->ss-it->ss)%2) continue;
// diagonal ends: "top" side?
int x =it->ss+(jt->ff-it->ff+jt->ss-it->ss)/2;
bool b =false;
if(x <= jt->ss && x > it->ss) {
A[it->ff][x].B[k] =true;
b =true;
A[it->ff][x].diag[k]++;}
// diagonal ends: "right" side?
int y =jt->ff-(jt->ff-it->ff+jt->ss-it->ss)/2;
if(y < jt->ff && y >= it->ff) {
A[y][jt->ss].B[(4+k-1)%4] =true;
if(b) A[y][jt->ss].B[4+(4+k-1)%4] =true;
A[y][jt->ss].diag[k]++;}
}
// rotate -90°
vector< vector<cell> > A0(N,vector<cell>(N));
for(int i =0; i < N; i++) for(int j =0; j < N; j++)
A0[j][N-1-i] =A[i][j];
A =A0;
ALL_THE(shops,it) {
swap(it->ff,it->ss);
it->ss =N-1-it->ss;}
}
for(int k =0; k < 4; k++) {
vector<bool> B(N,false);
for(int i =0; i < N; i++) {
bool b =false;
for(int j =0; j < N; j++) {
b =b|A[i][j].B[(3+k)%4];
B[j] =B[j]|A[i][j].B[4+(2+k)%4];
if(j > 0) B[j] =B[j]|B[j-1];
A[i][j].A =A[i][j].A&(!(b|B[j]));}
}
// diagonals
for(int i =0; i < 2*N; i++) { // x+y
int d =0;
for(int j =-N; j <= N; j++) { // x-y
if((i+j)%2) continue;
int x =(i+j)/2, y =(i-j)/2;
if(x < 0 || y < 0 || x >= N || y >= N) continue;
d +=A[x][y].diag[k];
if(d > 0) A[x][y].A =false;
d -=A[x][y].diag[(2+k)%4];}
}
// rotate -90°
vector< vector<cell> > A0(N,vector<cell>(N));
for(int i =0; i < N; i++) for(int j =0; j < N; j++)
A0[j][N-1-i] =A[i][j];
A =A0;}
for(int i =0; i < N*N; i++)
cout << (A[i/N][i%N].A?"A":"N") << ((i%N == N-1)?"\n":" ");
return 0;}
// look at my code
// my code is amazing