readlines.each do |str|
        num = 0
        win = "0"
        str = gets.chop
        if str==nil then
                break
        end
        for i in 0..2 do
                if str[num]==str[num+1] && str[num]==str[num+2] then
                        if win=="0" then
                                win = str[num]
                        end
                end
                num += 3
        end
        for i in 0..2 do
                if str[i]==str[i+3] && str[i]==str[i+6] then
                        if win=="0" then
                                win = str[i]
                        end
                end
        end
        if (str[0]==str[4]&&str[0]==str[8])||(str[2]==str[4]&&str[2]==str[6]) then
                if win=="0" then
                        win = str[4]
                end
        end
        if win == "o"||win == "x" then
                print win,"\n"
        else
                print "d\n"
        end