fun main(args:Array<String>?): Unit {
    val teamName = arrayOf("NS", "EW")
    while(true){
        val header = readLine()!!.trim()
        if (header == "#") return
        val trump = header.first().asSuit()
        val  players = Array(4){
            readLine()!!.trim().split(' ').map{Card(it)}
        }
        val winCount = IntArray(2){0}
        var prevWinner = 0
        for (i in 0 until 13) {
            prevWinner = players.indices.filter{players[it][i].suit == trump}.maxBy{players[it][i].number} ?: players.indices.filter{players[it][i].suit == players[prevWinner][i].suit}.maxBy{players[it][i].number}!!
            winCount[prevWinner % 2]++
        }
        println(
                winCount.indices.maxBy(winCount::get)?.let{"${teamName[it]} ${winCount[it] - 6}"}
        )
    }
}
enum class Suit {
    Clover, Diamond, Heart, Spade
}
sealed class CardNumber: Comparable<CardNumber> {
    protected abstract val value: Int
    private fun asRank(): Int = (value + 11) % 13
    override fun compareTo(other: CardNumber): Int {
        return asRank().compareTo(other.asRank())
    }
    data class Number(override val value: Int): CardNumber()
    data class Sign(override val value: Int): CardNumber()
}
fun Char.asSuit(): Suit {
    return when(this){
        'C' -> Suit.Clover
        'D' -> Suit.Diamond
        'H' -> Suit.Heart
        'S' -> Suit.Spade
        else -> TODO()
    }
}
fun Char.asCardNumber(): CardNumber {
    return if (isDigit()) CardNumber.Number(this - '0') else CardNumber.Sign(when (this) {
        'T' -> 10
        'J' -> 11
        'Q' -> 12
        'K' -> 13
        'A' -> 1
        else -> TODO()
    })
}
data class Card(val number: CardNumber, val suit: Suit) {
    constructor(expression: String):this(expression[0].asCardNumber(), expression[1].asSuit())
}
