Polynomial procedure of avoiding multiqubit errors arising due to qubit-qubit interaction