def charDiff(String c1, String c2) {
    return (c1 as char) - (c2 as char)
}

def decodeCoords(String s) {
    return [charDiff(s[0], 'a'), charDiff(s[1], '1')]
}

def checkCoords(coords) {
    return ((coords[0] in (0..7)) && (coords[1] in (0..7)))
}

def knightMove(legitKnightPositions) {
    def knightMoves = [[1, 2], [2, 1], [2, -1], [1, -2], [-1, -2], [-2, -1], [-2, 1], [-1, 2]]
    def result = ([0]*64).collate(8)
    (0..<8).each { x ->
        (0..<8).each { y ->
            if (legitKnightPositions[x][y]) {
                knightMoves.each { move ->
                    def newCoord = [x + move[0], y + move[1]]
                    if (checkCoords(newCoord)) {
                        result[newCoord[0]][newCoord[1]] = 1
                    }
                }
            }
        }
    }
    return result
}

def draughtsmanMoves(c) {
    return [[-1, -1], [1, -1]].collect { [c[0] + it[0], c[1] + it[1]] }.findAll { checkCoords(it) }
}

boolean solve(k, d, move) {
    if (d[1] == 0) return false
    if (k.flatten().find() == null) return false
    if (move == 'white') {
        k = knightMove(k)
        if (k[d[0]][d[1]]) return true
        return solve(k, d, 'black')
    }
    else {
        def moves = draughtsmanMoves(d)
        moves.each {
            if (it[0] in [1..6]) {
                if (k[it[0]][it[1]]) k[it[0]][it[1]] = 0
            }
        }
        def blackWinStrategy = moves.find { solve(k, it, 'white') == false }
        return (blackWinStrategy == null)
    }
}

//def s = new Scanner('a1 b6 white')
def s = new Scanner(System.in)
def tokens = s.nextLine().split(/\s/).toList()
def (knight, draughtsman) = tokens[0..<2].collect(this.&decodeCoords)
def firstMove = tokens[2]
def knightPos = ([0]*64).collate(8)
knightPos[knight[0]][knight[1]] = 1
println solve(knightPos, draughtsman, firstMove) ? "white wins" : "black wins"
