while gets
    win="d"
    p=0
    s=$_.chomp
    0.step(8,3) do |i|
        if(s[0+i]==s[1+i]&&s[1+i]==s[2+i])#?¨?
            win=s[0+i]
            break
        end
        if(s[3*0+p]==s[3*1+p]&&s[3*1+p]==s[3*2+p])#???
            win=s[0*i+p]
            break
        end
        p+=1
    end
    win=s[0] if(s[0]==s[4]&&s[4]==s[8])#??????
    win=s[2] if(s[2]==s[4]&&s[4]==s[6])#??????
    puts win
end