while gets do
  a = $_.chomp.chars

  res = nil
  3.times do |i|
    if a[3*i] == a[3*i+1] and a[3*i] == a[3*i+2]
      next if a[3*i] == 's'
      res = a[3*i]
      break
    elsif a[i] == a[i+3] and a[i] == a[i+6]
      next if a[i] == 's'
      res = a[i]
      break
    end
  end

  if res
    puts res
  elsif ((a[0] == a[4] and a[0] == a[8]) or (a[2] == a[4] and a[2] == a[6])) and a[4] != 's'
    puts a[4]
  else
    puts 'd'
  end
end