require 'yaml'

keys = STDIN.gets.chomp.split('.')
yaml = STDIN.readlines.map(&:chomp).join("\n")

object = YAML.load(yaml)
keys[1..-1].each do |key|
  if object.is_a?(Hash) && (object[key] || object[key.to_i])
    object = object[key] || object[key.to_i]
  else
    puts "no such property"
    exit
  end
end

if object.is_a? Hash
  puts "object"
else
  puts "string \"#{object}\""
end

