class B: passclass C(B): passclass D(C): passfor c in [B, C, D]: try: raise c() except D: print "D" except C: print "C" except B: print "B"