import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val n = nextInt() val q = nextInt() val a = Array(n) { nextInt() } val bit = BIT(n) for (i in 0 until n) { if (a[i] == 1) { bit.add(i, 1) } } for (_i in 0 until q) { val t = nextInt() val x = nextInt() val y = nextInt() if (t == 1) { if (a[x - 1] == 1) { bit.add(x - 1, -1) } a[x - 1] = y if (y == 1) { bit.add(x - 1, 1) } } else { var l = x - 1 var r = y - 1 while (r - l > 1) { val mid = (l + r) / 2 val sum = bit.sum(mid..r) val len = (mid..r).count().toLong() if (sum == len) { r = mid } else { l = mid } } val count = if (a[r] != 1) 0 else if (a[l] == 1) y - x + 2 else y - 1 - l println(if (count % 2 == 0) "F" else "S") } } } class BIT(private val n: Int) { private val data = LongArray(n) { 0 } fun add(i: Int, x: Long) { var p = i + 1 while (p <= n) { data[p - 1] += x p += p and -p } } fun sum(range: IntRange): Long { val l = range.first val r = range.last + 1 return sum(r) - sum(l) } private fun sum(i: Int): Long { var r = i var s = 0L while(r > 0) { s += data[r - 1] r -= r and -r } return s } } fun main() { Thread(null, { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() }, "solve", abs(1L.shl(26))) .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } } .apply { start() }.join() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion