For the sake of solving this problem, I even downloaded a book, then I think that m = 1, n = 3. I have no other solution. It is a pity that there is no answer. Really solving this problem is harder than winning a jackpot at
https://mr.bet/at/blog/online-spielothek/fruit-zen. I hope someone will write a decent answer to solving this problem.