#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
using namespace std;
using ll = long long;
const int INF = 1e9;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    for (int i = 0; i < int(v.size()); i++) {
        os << v[i];
        if (i < sz(v) - 1) os << ' ';
    }
    return os;
}
int main() {
    string s;
    cin >> s;
    deque<char> t;
    bool rev = 0;
    for (char c : s) {
        if (c == 'R') {
            rev ^= 1;
            continue;
        }
        if (rev) {
            t.push_front(c);
        } else {
            t.push_back(c);
        }
    }
    if (rev) reverse(all(t));
    string ans;
    for (int c : t) {
        if (!ans.empty() and ans.back() == c) {
            ans.pop_back();
        } else {
            ans += c;
        }
    }
    cout << ans << '\n';
}
#include <bits/stdc++.h>

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

template<typename T>
void printArray(vector<T> &printVec) {
    if(printVec.empty()) return;
    cout << printVec[0];
    for(int i = 1; i < printVec.size(); ++i) cout << " " << printVec[i];
    cout << endl;
}

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N;
    cin >> N;
    vector<int> res(N + 1, 0);

    int c = 2;
    for(int i = N; i >= 1; --i) {
        int mn = 0;
        for(int j = i * 2; j <= N; j += i) {
            mn = max(mn, res[j]);
        }
        res[i] = mn + 1;
    }

    for(int i = 1; i <= N; ++i) {
        for(int j = i * 2; j <= N; j += i) {
            if(i % j == 0 && res[i] == res[j]) {
                cout << -1 << endl;
                return 0;
            }
        }
    }

    for(int i = 1; i <= N; ++i) {
        cout << res[i] << " ";
    }
    cout << endl;
    return 0;
}
