object Main extends App {
  import scala.io.StdIn._

  val target = readLine.trim.split('.').tail
  var lines = Nil: List[String]
  var line = readLine
  while (line != null){
    lines ::= line
    line = readLine
  }
  val mapping = new Mapping(new Indented(0))
  lines.reverse.mkString("", "\n", "\n").toList match {
    case m mapping Nil ⇒
      var result :List[YamlObject] = m
      for (key ← target){
        result = result.flatMap{
          case o: YamlClass if o.key == key ⇒ o.properties
          case _ ⇒ None
        }
      }
      result match {
        case Nil ⇒ println("no such property")
        case (h:YamlClass)::_ ⇒ println("object")
        case (h:Value)::_ ⇒ println(s"""string "${h.string}"""")
      }
    case _ ⇒ ???
  }
  sealed trait YamlObject
  class YamlClass(val key: String, var properties: List[YamlObject]) extends YamlObject
  class Value(val string: String) extends YamlObject


  class Mapping(val indented: Indented) {
    def unapply(arg: List[Char]): Option[(List[YamlClass], List[Char])] = {
      val mappingItem = new MappingItem(indented)
      val mapping = this
      arg match {
        case mi mappingItem xs ⇒
          xs match {
            case m mapping rest ⇒ Some(mi::m, rest)
            case _ ⇒ Some(List(mi), xs)
          }
        case _ ⇒ None
      }
    }
  }
  class MappingOver(val indented: Indented) {
    def unapply(arg: List[Char]): Option[(List[YamlClass], List[Char])] = {
      val indentedOver = new IndentedOver(indented)
      arg match {
        case m indentedOver _ ⇒
          val mapping = new Mapping(m)
          arg match {
            case l mapping rest ⇒ Some(l, rest)
            case _ ⇒ None
          }
        case _ ⇒ None
      }
    }
  }
  class MappingItem(val indented: Indented) {
    def unapply(arg: List[Char]): Option[(YamlClass, List[Char])] = {
      arg match {
        case indented(key Key ':'::rest) ⇒ rest match {
          case ' '::(value Strings '\n'::xs) ⇒ Some(new YamlClass(key, List(value)), xs)
          case '\n'::xs ⇒
            val mapping = new MappingOver(indented)
            xs match {
              case l mapping t ⇒ Some(new YamlClass(key, l), t)
              case _ ⇒ ???
            }
          case _ ⇒ ???
        }
        case _ ⇒ None
      }
    }
  }
  class IndentedOver(val indented: Indented) {
    def unapply(arg: List[Char]): Option[(Indented, List[Char])] = {
      arg.span(_.isSpaceChar) match {
        case (x, xs) if x.length > indented.n ⇒ Some(new Indented(x.length), xs)
        case _ ⇒ None
      }
    }
  }
  class Indented(val n: Int) extends AnyVal {
    def unapply(arg: List[Char]): Option[List[Char]] = {
      arg.span(_.isSpaceChar) match {
        case (x, xs) if x.length == n ⇒ Some(xs)
        case _ ⇒ None
      }
    }
  }
  object Key {
    def unapply(arg: List[Char]): Option[(String, List[Char])] = {
      arg.span(_.isLetterOrDigit) match {
        case (Nil, _) ⇒ None
        case (key, xs) ⇒ Some(key.mkString, xs)
      }
    }
  }
  object Strings {
    def unapply(arg: List[Char]): Option[(Value, List[Char])] = {
      arg.span(c ⇒ c.isLetterOrDigit || c.isSpaceChar) match {
        case (Nil, _) ⇒ None
        case (words, rest) ⇒ Some(new Value(words.mkString), rest)
      }
    }
  }
}
