object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  val Array(n, q) = readLine.trim.split(' ').map(_.toInt)
  val ranges = toRange(readLine.trim.split(' ').map(_.toInt))
  val color = readLine.trim.split(' ').map(_ == "G")
  val segTree = SegTree(color.zipWithIndex.sortBy(it ⇒ ranges(it._2).last).map(_._1))
  for (_ ← 0 until q){
    val query = readLine.trim.toInt
    val range = ranges(query - 1)
    segTree.flip(range.start, range.end)
    println(if (segTree.count * 2 > n) "broccoli" else "cauliflower")
  }

  def toRange(array: Array[Int]): Array[Range] = {
    val children = Array.tabulate(array.length + 1){_ ⇒ Nil: List[Int]}
    val length = Array.tabulate(array.length + 1){_ ⇒ 0}
    for (i ← array.indices.reverse){
      length(i + 1) = children(i + 1).map{c ⇒ length(c)}.sum + 1
      children(array(i) - 1) ::= i + 1
    }
    length(0) = children(0).map(c ⇒ length(c)).sum + 1
    val vertex = children.indices.map{i ⇒ new Vertex(length(i))}.toArray
    for (i ← vertex.indices){vertex(i).setChildren(children(i).map(j ⇒ vertex(j)))}
    vertex(0).depthOne(0)
    for (i ← vertex.indices){vertex(i).confirm}
    vertex.map{_.range}
  }
  class Vertex(val length: Int) {
    private var children: List[Vertex] = Nil
    def setChildren(child: List[Vertex]):Unit = {
      children = child
    }
    var range: Range = 0 until 0
    def depthOne(from: Int): Unit = {
      range = from until (from + length)
    }
    def confirm: Unit = {
      var left = range.head
      for (child ← children){
        child.depthOne(left)
        left += child.length
      }
    }
  }
  object SegTree{
    def apply(array: Array[Boolean]): SegTree = {
      def sub(from: Int, until: Int): SegTree = {
        if (from + 1 == until) new Leaf(array(from))
        else {
          val mid = (from + until) / 2
          new Node(sub(from, mid), sub(mid, until))
        }
      }
      sub(0, array.length)
    }

  }
  sealed trait SegTree {
    def size: Int
    def flip(from: Int, until: Int): Unit
    def count: Int
  }
  class Node(private var left: SegTree, private var right: SegTree) extends SegTree {
    val size: Int = left.size + right.size
    private var mCount: Int = left.count + right.count
    private var mWholeFlip: Boolean = false
    override def flip(from: Int, until: Int): Unit = {
      if (from <= size && 0 < until) {
        if (from <= 0 && size <= until){
          mWholeFlip = !mWholeFlip
        }else {
          if (mWholeFlip) {
            mWholeFlip = false
            left.flip(0, left.size)
            right.flip(0, right.size)
          }
          left.flip(from, until)
          right.flip(from - left.size, until - left.size)
          mCount = left.count + right.count
        }
      }
    }

    override def count: Int = {
      if (mWholeFlip){
        size - mCount
      }else {
        mCount
      }
    }

    override def toString: String = s"$left,$right"
  }
  class Leaf(var bool: Boolean) extends SegTree {
    override def size: Int = 1
    override def flip(from: Int, until: Int): Unit = {
      if (from <= 0 && 0 < until) bool = !bool
    }
    override def count: Int = if (bool) 1 else 0

    override def toString: String = if (bool) "T" else "F"

  }
  implicit class Extension[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}


Measured memory_bytes: 177924