object Main extends App {
  val in = scala.io.Source.stdin.getLines.toSeq
  val ls = in.map(e => e.split(' ').toArray).toArray
  val S = ls(0)(0)
  val list = ls.tail.tail
  
  var state = true
  var str = Vector(S(0).toChar)
  list.foreach{ line =>
    //println(str)
    if(line(0) == "1") state = !state
    else{
      val is = (line(1) == "1") ^ state
      val add = (line(2))(0).toChar
      str = if(is) str :+ add else add +: str
    }
  }
  val ret = if(state) str else str.reverse
  println(ret.mkString)
}
