#include <iostream>
#include <string>
#include <cassert>
using namespace std;
#define FOR(i,n) for(int i=0;i<(n);i++)
int a[128][128];
int main() {
int T;
cin >> T;
FOR(i,T) FOR(j,T) {
string inp;
cin >> inp;
a[i][j] = (inp == "YES");
}
int pos = 0, res;
int az = false;
FOR(i,T) {
bool _az = true;
FOR(j,T) _az = (_az && !a[i][j]);
az = (az || _az);
}
if(!az) {
pos++;
res = -1;
}
FOR(i,T) if(a[i][i]) {
int iso = 0;
FOR(j,i) if(a[i][j]) iso = 1;
if(iso) continue;
bool f = true;
FOR(j,T) if(f) {
if(a[i][j]) FOR(k,T) f = (f && (a[i][k] == a[j][k]));
else {
bool m = true;
FOR(k,T) m = (m && (a[i][k] == a[j][k]));
if(m) f = false;
}
}
if(f) {
pos++;
res = i;
}
}
// lets verify there is no other valid output!
assert(pos == 1);
FOR(i,T) cout << (res==-1?"NO":(a[res][i]?"YES":"NO")) << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgoKI2luY2x1ZGUgPGNhc3NlcnQ+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBGT1IoaSxuKSBmb3IoaW50IGk9MDtpPChuKTtpKyspCgppbnQgYVsxMjhdWzEyOF07CgppbnQgbWFpbigpIHsKICAgIGludCBUOwogICAgY2luID4+IFQ7CiAgICBGT1IoaSxUKSBGT1IoaixUKSB7CiAgICAgICAgc3RyaW5nIGlucDsKICAgICAgICBjaW4gPj4gaW5wOwogICAgICAgIGFbaV1bal0gPSAoaW5wID09ICJZRVMiKTsKICAgIH0KICAgIGludCBwb3MgPSAwLCByZXM7CiAgICBpbnQgYXogPSBmYWxzZTsKICAgIEZPUihpLFQpIHsKICAgICAgICBib29sIF9heiA9IHRydWU7CiAgICAgICAgRk9SKGosVCkgX2F6ID0gKF9heiAmJiAhYVtpXVtqXSk7CiAgICAgICAgYXogPSAoYXogfHwgX2F6KTsKICAgIH0KICAgIGlmKCFheikgewogICAgICAgIHBvcysrOwogICAgICAgIHJlcyA9IC0xOwogICAgfQogICAgRk9SKGksVCkgaWYoYVtpXVtpXSkgewogICAgICAgIGludCBpc28gPSAwOwogICAgICAgIEZPUihqLGkpIGlmKGFbaV1bal0pIGlzbyA9IDE7CiAgICAgICAgaWYoaXNvKSBjb250aW51ZTsKICAgICAgICBib29sIGYgPSB0cnVlOwogICAgICAgIEZPUihqLFQpIGlmKGYpIHsKICAgICAgICAgICAgaWYoYVtpXVtqXSkgRk9SKGssVCkgZiA9IChmICYmIChhW2ldW2tdID09IGFbal1ba10pKTsKICAgICAgICAgICAgZWxzZSB7CiAgICAgICAgICAgICAgICBib29sIG0gPSB0cnVlOwogICAgICAgICAgICAgICAgRk9SKGssVCkgbSA9IChtICYmIChhW2ldW2tdID09IGFbal1ba10pKTsKICAgICAgICAgICAgICAgIGlmKG0pIGYgPSBmYWxzZTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBpZihmKSB7CiAgICAgICAgICAgIHBvcysrOwogICAgICAgICAgICByZXMgPSBpOwogICAgICAgIH0KICAgIH0KICAgIAogICAgLy8gbGV0cyB2ZXJpZnkgdGhlcmUgaXMgbm8gb3RoZXIgdmFsaWQgb3V0cHV0IQogICAgYXNzZXJ0KHBvcyA9PSAxKTsKICAgIEZPUihpLFQpIGNvdXQgPDwgKHJlcz09LTE/Ik5PIjooYVtyZXNdW2ldPyJZRVMiOiJOTyIpKSA8PCBlbmRsOwogICAgcmV0dXJuIDA7Cn0=