readlines.each do |l|
  l.chomp!
  win = "d"
  (0..6).step(3) {|i| win = l[i] if l[i] == l[i+1] && l[i] == l[i+2] && l[i] != "s"}
  (0..2).each {|i| win = l[i] if l[i] == l[i+3] && l[i] == l[i+6] && l[i] != "s"} 
  win = l[0] if l[0] == l[4] && l[0] == l[8] && l[0] != "s"
  win = l[2] if l[2] == l[4] && l[2] == l[6] && l[2] != "s"
  puts win 
end