#include using namespace std; #ifdef _RUTHEN #include #else #define show(...) true #endif using ll = long long; #define rep(i, n) for (int i = 0; i < (n); i++) template using V = vector; template struct monoid { using value_type = S; static constexpr S op(S a, S b) { return ((b >> (a & 1)) & 1) | (((b >> (a >> 1 & 1)) & 1) << 1); } static constexpr S e() { return 2; } }; template struct segment_tree { public: using S = typename Monoid::value_type; segment_tree() : segment_tree(0) {} segment_tree(int n) : segment_tree(std::vector(n, Monoid::e())) {} segment_tree(const std::vector& v) : _n((int)v.size()) { log = 0; while ((1U << log) < (unsigned int)(_n)) log++; size = 1 << log; d = std::vector(size << 1, Monoid::e()); for (int i = 0; i < _n; i++) d[i + size] = v[i]; for (int i = size - 1; i >= 1; i--) { update(i); } } void set(int p, const S& x) { assert(0 <= p and p < _n); p += size; d[p] = x; for (int i = 1; i <= log; i++) update(p >> i); } void chset(int p, const S& x) { assert(0 <= p and p < _n); p += size; d[p] = Monoid::op(d[p], x); for (int i = 1; i <= log; i++) update(p >> i); } S operator[](int p) const { assert(0 <= p and p < _n); return d[p + size]; } S get(int p) const { assert(0 <= p && p < _n); return d[p + size]; } S prod(int l, int r) const { assert(0 <= l and l <= r and r <= _n); S sml = Monoid::e(), smr = Monoid::e(); l += size; r += size; while (l < r) { if (l & 1) sml = Monoid::op(sml, d[l++]); if (r & 1) smr = Monoid::op(d[--r], smr); l >>= 1; r >>= 1; } return Monoid::op(sml, smr); } S all_prod() const { return d[1]; } template int max_right(int l, F& f) const { assert(0 <= l and l <= _n); assert(f(Monoid::e())); if (l == _n) return _n; l += size; S sm = Monoid::e(); do { while ((l & 1) == 0) l >>= 1; if (!f(Monoid::op(sm, d[l]))) { while (l < size) { l <<= 1; if (f(Monoid::op(sm, d[l]))) { sm = Monoid::op(sm, d[l]); l++; } } return l - size; } sm = Monoid::op(sm, d[l]); l++; } while ((l & -l) != l); // 2べきまたは0のときfalse return _n; } template int min_left(int r, F& f) const { assert(0 <= r and r <= _n); assert(f(Monoid::e())); if (r == 0) return 0; r += size; S sm = Monoid::e(); do { r--; while (r > 1 and (r & 1)) r >>= 1; if (!f(Monoid::op(d[r], sm))) { while (r < size) { r = (r << 1) | 1; if (f(Monoid::op(d[r], sm))) { sm = Monoid::op(d[r], sm); r--; } } return r + 1 - size; } sm = Monoid::op(d[r], sm); } while ((r & -r) != r); // 2べきまたは0のときfalse return 0; } private: int _n, log, size; std::vector d; inline void update(int k) { d[k] = Monoid::op(d[k << 1], d[(k << 1) | 1]); } }; /** * @brief Segment Tree (セグメント木) * @docs docs/data_structure/segment_tree.md */ int main() { ios::sync_with_stdio(false); cin.tie(0); int N, Q; cin >> N >> Q; V A(N); rep(i, N) cin >> A[i]; V B(N); rep(i, N) B[i] = (A[i] > 1 ? 3 : 1); segment_tree> seg(B); rep(qq, Q) { int T, X, Y; cin >> T >> X >> Y; if (T == 1) { seg.set(X - 1, (Y > 1 ? 3 : 1)); } else { cout << (seg.prod(X - 1, Y) & 1 ? 'F' : 'S') << '\n'; } } return 0; }