#include <bits/stdc++.h>
using namespace std;
const int N = 55;
int n, flag = 0;
int g[N][N];
int res[N];
bool st[N];
void dfs(int u, int len) {
if (flag) return;
res[len] = u;
if (len == n) {
if (g[u][1] == 1) flag = 1;
return;
}
int loop = 0;
for (int i = 1; i <= n; i++) {
if (!st[i] && g[i][1] == 1) {
loop = 1;
break;
}
}
if (loop == 0) return;
for (int i = 1; i <= n; i++) {
int j = g[u][i];
if (!st[i] && u != i && j == 1) {
st[u] = true;
dfs(i, len + 1);
st[u] = false;
}
}
}
int main() {
cin >> n;
memset(g, 0, sizeof g);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
char t;
cin >> t;
if (t == 'W') {
g[i][j] = 1;
} else if (t == 'L') {
g[j][i] = 1;
}
}
dfs(1, 1);
if (flag) {
for (int i = 1; i <= n; i++) {
if (i == n)
cout << res[i];
else
cout << res[i] << " ";
}
} else {
cout << "No Solution" << endl;
}
}