Improve automation of writing class_link matrix. Now only input when not equal or not multiple.