for g in range(t):
for i in range(1,m+1):
for j in range(n):
Please reformat the code or post a link to your answer instead as it is not understandable.
As I can somewhat understand from your code that you are collecting the prices of baskets of each type of fruits and checking if its minimum upto now. I would recommend using a dict to store the combined prices of each fruit basket and then print out the minimum of it.