def winner(cells)
  winner_patterns = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6], [1, 4, 7], [2, 5, 8], [0, 4, 8], [2, 4, 6]]
  winner_patterns.each do |winner_pattern|
    if cells[winner_pattern[0]] == cells[winner_pattern[1]] && cells[winner_pattern[1]] == cells[winner_pattern[2]]
      return cells[winner_pattern[0]]
    end
  end   
  'd'
end

while line = gets
  cells = line.chomp.split('')
  puts winner(cells)
end