# Arup Guha
# 11/30/2018
# Solution to 2018 UCF HS Online Problem: Sharon the Slayer

MAXENERGY = 100

def main():

    nC = int(input(""))

    # Go through each case:
    for loop in range(1,nC+1):

        # Get the characteristics of both players.
        vals = input("").split()
        slayerPts = int(vals[0])
        slayerMoves = int(vals[1])
        slayerEng = int(vals[2])
        monsterPts = int(vals[3])
        monsterAtt = int(vals[4])

        # Here are the lists that matter.
        charge = []
        allattack = []
        block = []

        # Read in all of the moves.
        for i in range(slayerMoves):

            vals = input("").split()
            moveT = int(vals[0])
            power = int(vals[1])
            energy = int(vals[2])

            # Attacks only go in this list.
            if moveT == 1:
                allattack.append([vals[1], vals[2]])

            # Blocks go here.
            if moveT == 2:
                block.append([vals[1], vals[2]])

            # Charges add to two lists.
            if moveT == 3:
                allattack.append([vals[1], vals[2]])
                charge.append([vals[1], vals[2]])

        res = False

        # First try winning with charges.
        winC = minEnergy(charge, monsterPts, slayerEng)
        res = (winC >= 0)

        # First assume we don't need to block at all.
        protect = 0

        # Otherwise, we must first protect against an attack to
        # get to 1 more than what the monster can do to us.
        if slayerPts <= monsterAtt:
            protect = minEnergy(block, monsterAtt+1-slayerPts, energy)

        # Only case where we can still win.
        if protect >= 0:

            # Update our energy to reflect our protection.
            slayerEng -= protect

            # As long as we have energy left, see if we can slay the monster.
            if slayerEng >= 0:
                winA = minEnergy(allattack, monsterPts, slayerEng)
            res = (winA >= 0)

        # Print out the result.
        if res:
            print("Fight #",loop,": Win", sep="")
        else:
            print("Fight #",loop,": Lose", sep="")
            
# Returns the minimum amt of energy needed to generate powNeeded
# power from a subset of items.
def minEnergy(items, powNeeded, energy):

    # We need some energy for any task.
    if energy <= 0:
        return -1

    # Initially, the most power we get for any energy level is 0.
    # dp[i] = max power obtained for i energy.
    dp = [0]*(energy+1)

    # Except for 0 =)
    dp[0] = 0

    # Go through each item.
    for i in range(len(items)):

        # j is energy level, going backwards.
        for j in range(len(dp)-1,int(items[i][1])-1,-1):

            # Take the larger of my old value or using this item.
            dp[j] = max(dp[j], dp[j-int(items[i][1])] + int(items[i][0]))

    # Find the smallest i that is sufficient.
    for i in range(len(dp)):
        if dp[i] >= powNeeded:
            return i

    # Can't do it.
    return -1

# Run it
main()
