Comments

condition in problem f is given aij ≤ max(aik, ajk) but in editorial it is aij ≤ max(ai, k1, ak1, k2, ..., akm, j) . i think ajk and akm,j aren't same.

got it

why second test case of problem F is not magic?