"ich frage den Mann, ob er Hilfe braucht, dann helfe ich dem Mann."The first blank becomes "den", because the verb "fragen" takes the accusative case, and the second becomes "dem", because the verb "helfen" takes the dative case. The case required can sometimes be determined by whether the verb indicates movement, in which case it takes the accusative case, or if it indicates position or placement, in which case it takes the dative. In this as in many cases however, the case needed simply needs to be learned along with the verb.