#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
bool check(int m, char c, int l, int r){
    bool res = true;
    if(m == 0){
        if(c == 'o'){
            if(l != r) res = false;
        }else{
            if(l == r) res = false;
        }
    }else{
        if(c == 'o'){
            if(l == r) res = false;
        }else{
            if(l != r) res = false;
        }
    }
    return res;
}

int main(){
    int n; cin >> n;
    string s; cin >> s;
    string v[4] = {"00", "01", "10", "11"};
    rep(i,4){
        vector<int> t(n);
        rep(j,2) t[j] = (v[i][j] == '0') ? 0 : 1;

        FOR(k, 1, n-1){
            if(t[k] == 0){
                if(s[k] == 'o'){
                    t[k+1] = t[k-1];
                }else{
                    t[k+1] = 1-t[k-1];
                }
            }else{
                if(s[k] == 'o'){
                    t[k+1] = 1-t[k-1];
                }else{
                    t[k+1] = t[k-1];
                }
            }
        }

        if(!check(t[n-1], s[n-1], t[n-2], t[0])) continue;
        if(!check(t[0], s[0], t[n-1], t[1])) continue;

        rep(l, n) printf("%c", t[l] == 0 ? 'S' : 'W');
        cout << endl;
        return 0;
    }

    cout << "-1" << endl;
    return 0;
}
#include <bits/stdc++.h>

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<ll> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}


bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
//typedef priority_queue<P, vector<P>, greater<P> > PQ_ASK;


int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> v(n, vector<int>(m));
    rep(i, n) rep(j, m) cin >> v[i][j], v[i][j]--;

//    rep(i, n) reverse(v[i].begin(), v[i].end());

    vector<bool> exclude(m, false);

    int ans = INT_MAX;

    while (count(exclude.begin(), exclude.end(), false) > 0) {
        vector<int> join(m);

        rep(i, n) {
            rep(j, m) {
                int t = v[i][j];
                if (!exclude[t]) {
                    join[t]++;
                    break;
                }
            }
        }

        int now = *max_element(join.begin(), join.end());
//        cout << now << endl;
        cmin(ans, now);
        rep(i, m) {
            if (join[i] == now) {
                exclude[i] = true;
            }
        }

    }
    cout << ans << endl;

}