fun main(args:Array<String>):Unit {
    repeat(readLine()!!.toInt()){
        val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
        val map = Array(y + 1){ypos -> Array(x + 1){xpos -> Cross(Point(xpos, ypos))}}
        map[0][0] = Home
        for (i in 1 .. y) for (j in 0 .. x) map[i][j].addUpCross(map[i - 1][j])
        for (i in 0 .. y) for (j in 1 .. x) map[i][j].addLeftCross(map[i][j - 1])
        repeat(readLine()!!.trim().toInt()){
            val (x1, y1, x2, y2) = readLine()!!.trim().split(' ').map(String::toInt)
            map[maxOf(y1, y2)][maxOf(x1, x2)].remove(Point(minOf(x1, x2), minOf(y1, y1)))
        }
        println(if (map[y][x].countRoute() == 0L) "Miserable Hokusai!" else map[y][x].countRoute() )
    }
}
data class Point(val x:Int, val y:Int)
object Home:Cross(Point(0, 0)){
    override fun countRoute(): Long = 1
}
open class Cross(val position:Point){
    private var mRouteMemo:Long = -1
    private var mUpCross:Cross? = null
    private var mLeftCross:Cross? = null
    fun addUpCross(other:Cross):Unit {
        mUpCross = other
    }
    fun addLeftCross(other:Cross):Unit {
        mLeftCross = other
    }
    fun remove(point:Point):Unit {
        when (point.x){
            position.x -> mUpCross = null
            else -> mLeftCross = null
        }
    }
    open fun countRoute():Long {
        return when(mRouteMemo){
            -1L -> {
                mRouteMemo = mUpCross?.countRoute() ?: 0
                mRouteMemo += mLeftCross?.countRoute() ?: 0
                mRouteMemo
            }
            else -> mRouteMemo
        }
    }
}
